Rails Application without Database - ruby-on-rails

Here I want to develop online chat application in Rails but without database so, I thought of using sessions instead.
Coming to application users will come to home page and click join chat button after that by filling two fields (like Name and Gender) his record should create in session.
after chat by closing his record should automatically destroy.
Is there any sample work-arround or example for this kind of application online?

This answer: https://stackoverflow.com/a/821269/382982 will help you remove Rails' default database dependency. Sessions should still work normally (http://guides.rubyonrails.org/action_controller_overview.html#session).

Related

Ruby on Rails API Deleted Account but Don't want lose all booking system

There is a lot of changing with Data Protection and GDPR. I am not sure which is the right method for me to develop it.
The reason I was looking for advice because of the new Apply policy on account of deletion requirements extended https://developer.apple.com/news/?id=i71db0mv
We are using ROR API. and we have mobile App but we don’t have deletion account, only Deactivate Account cos we need to keep a record on booking history.
I was thinking something like that.
Create a new table “old_user_table” with old user_id, first name, second name, email, and booking slug.
It will allow keep all users who did previous booking. And deleted their user ID in the app. We need to keep all records for booking for audit purpose in the last 5-10 years in the app.
The user setup with this app, the user but never booking, then the user will not transfer to “old_user_table” cos the user booking nothing.
Does it make sense? Something like that? Or do you have a better alternative?
(FYI I’m not RoR Developer but I want to make sure I have better knowledge or better case before meeting with Ruby developers & IOS developer).
That approach won't be GDPR compliant since you are keeping PII in the old_ table.
If you want to keep the old bookings I would replace the user_id for some new random generated UUID that has no link with the real user, and then remove the user from the database.

Ruby on Rails. Using Google Client API to parse emails

I am new to Ruby and have a question about how to do a specific task on Rails.
I have a list of inventory and each item has a specific Stock ID that is emailed to my personal Gmail account. I want my web application to listen for emails from a specific email account. When my gmail receives an email from that specific account I want my application to parse it for a couple of fields and insert the stock ID into my database.
For example:
Let's say my database has an item with style code: A5U31 and size:10.
The email will say something like item with style code: A5U31 and size:10 has Stock ID:329193020.
I want my Rails application to search the database for an entry with that specific style code and size, and when it finds an entry to simply insert the stock ID into the row.
I am trying to using the Google-API-Client gem to this, but I am struggling, because I am still a beginner. So far I have done this quick-start guide to authenticate my gmail account with my rails app.
https://developers.google.com/gmail/api/quickstart/ruby?authuser=2
If someone could help me figure out how to write this sort of code and where to put it in my app(models, controllers, views) that would be very appreciated. Thanks!
I know it's been several months since you posted this, so you probably already have it worked out, but in case you still need a solution (or if someone else wants to do something similar), I'll share my thoughts:
At a high level, it sounds like your plan is
Identify when a new email has come in (either by polling or by using a push notification).
Grab the new email's content.
Parse the email's content in order to extract relevant data.
Use the data to query and update a database.
Based on the documentation for the Gmail API, it does look like you should be able to set up push notifications, so you won't have to poll the endpoint to get the information you need.
However, my big takeaway from this list is that none of the items on it really require Rails, since you're not exposing an external web API for requests. I suppose that you could leverage ActiveRecord to create an item model and use that to manage the database; however, since it seems like you'd only need to make some basic SQL queries (and the same ones each time), I'm not sure that bringing in ActiveRecord adds much value.
If I were trying to solve this problem myself, I would probably create a simple Ruby program that (a) uses the gem you mentioned to handle push notifications from the Gmail API, and (b) uses another gem to connect to whatever kind of database you're using (e.g. pg for Postgres) and make the necessary queries.
(All of this assumes, of course, that you aren't specifically using Rails for some other reason, e.g. adding this feature to an existing Rails application).

ASP MVC 5 Windows authentication with custom roles and Active Directory

I have an MVC 5 application set up with windows authentication and my own custom roles table for authorization. This works fine if the user exists in my application database - username in my users table maps to the usernames in active directory.
My question is how do I keep my users table in sync with active directory. Any time a new user is hired, a new record has to be added to my intranet application to ensure this user has access to it.
Is there a way to load users from active directory into my own users table perhaps with some kind of scheduled job or is there a better way to achieve what I'm trying to do?
I think sync two database instances (AD database and you app database) will become management issue as your business grow. Even, adding new user and removing is day to day work, so in both cases you need to execute some sort of action to add or remove users from your app database.
Why don't you ask your team to give you access of AD database and consume this into your intranet app, this is what I was using in my past organization and this works great.
The AD can be used in a programmatic manner. Just look for LDAP stuff and you'll find lots of examples. Here's one to get you started : Connect to Active Directory via LDAP
If your application allows people to register then implement your own custom membership provider which talks to the AD. You can create the users in the AD, you will have to pass the password requirements which are set on the AD as well, which is more than likely a good thing. The roles information can be stored there as well, no need for a local custom roles table either.

How to create a multi-domain app in Rails 4

I want to create a multi-domain app with Rails and have been wondering about the best approach.
The app will have a set of functionality that will be the same functionality across all domains, so the change in domain will only mean a change in the db used and the styling (and content obviously) but the models and controller will be the same.
The app will use MongoDB as the main storage (Redis for workers and other stuff that not directly relevant to model storage)
My idea is: Once a user signs up, a new record will be created but also a database will be created with the user id. The user model will store the database id (recently created), and the domain the user have just added. A vhost file would be created and the server reloaded.
Once the user visits the app (using the new domain). the app would check the url and find the correct db to use based on url. This would be saved into variable to be used throughout the app.
I imagine have this check to happen on each request.
I would appreciate thoughts and comments on this approach and best way to achieve this.

Rails 3 social networking app

I'am figuring out how the build a social network kind of site in Rails. In my site I've a User model. User can add photos, videos, text messages, events etc. Al these kind of updates are stringed together via a polymorphic association to the model Update.
Now for example a certain user follows 10 other users. What is the best way to created an overview of all the updates from the users that this certain user follows.
This post may help. It saves all the activities using the model in a table and then simply draws on them to create the activity stream.
Recent Activities in Ruby on Rails
This gem may also be of some use - looks like it largely does the job for you.
https://github.com/pokonski/public_activity

Resources