rabin prithvi

Joined

600 Experience
4 Lessons Completed
0 Questions Solved

Activity

Posted in Duration of a video in the listing page

Duration of a video in the listing page would be highly useful to select a video to watch.

Posted in Our First API (Example) - GoRails

Chris, adding the request.format = :json works only in Application Controller.
Tried to add in the show method directly, it is not working.
Any help to understand this?

Posted in Multi Site in Rails

Thank you Chris as always for your valuable inputs.
Since the Rails app is an API Client, I do not have any tables in the database.
Can I use the Apartment Gem even in this case?

Posted in Multi Site in Rails

Have a Rails app which acts as a API client.
Request may come from 6 different domains.
Each site will have same layout.
Difference between each site would be the theme color , logo and the text shown to the user, which comes from different API for each site.
I can see this solution,
Request from all the domains will be routed to same controller, but to different actions.
@current_site = request.domain will hold the current domain.
Use domain constraints for each request to ensure , it goes to the right controller and action. (This becomes verbose , have to define each route 6 times for each domain )
Each action will render the same template.
Pass the @current_site name in a class attribute of the main div tag, which javascript can pickup to render the theme.

My questions are

  1. Is there any better method to achieve this especially the routing seems bulky?
  2. If the application scales to million users, @current_site variable would render the correct theme?
  3. Thread.current can be used to store the current_site information and read that wherever I want to ensure each thread gets correct @current_site info?

Posted in Using Devise in Consumer App

Thank you very much Chris.

Posted in Using Devise in Consumer App

Thank you. I understand.
My API responds with user id and user token.
I can store user id in the session store during login and clear the session during logout.
Any security is compromised by this method ?
Anything else to improve apart from just storing user id in session?

Posted in Using Devise in Consumer App

I have two applications. One is Rails API consumer app and another is a legacy PHP one - which responds with JSON API. APIs are used for user registration and login. Can I use Devise for authenticating users in consumer Rails app?

I have two applications. One is Rails API consumer app and another is a legacy Php one which responds with JSON API. APIs are used for user registration and login. Can I use Devise for authenticatiing users in consumer app?