Ruby On Rails Moderate Interview Questions

Questions to ask a Ruby on Rails Developer

Ruby on Rails is unique in its ability to create a complete, working web application in approximately 5 minutes. A good Ruby on Rails interview should be an interactive coding session in which the candidate demonstrates their mastery of rapid iteration programming.

  1. Kick things off by asking them to Create a basic Rails App with nested routes .
  2. Familiarity with Javascript/AJAX is essential for modern Rails development. Ask the candidate to expand on their sample application and Load content via AJAX using Rails UJS.
  3. Designing a good data model is essential. Even more essential is designing a data model that fits well within the Rails framework. Build again on the sample app, by demonstrating their mastery of Rails Polymorphic Resources.
  4. Verify that they have a solid understanding of Rails Caching and especially Rails Caching and Slightly Dynamic Content.
  5. Ensure that they won't leave any gaping security holes in your application by asking about Rails Security: Mass Assignment.

Suppose that generating the home page of your application is very expensive. The content on the page is the same for every user (whether authenticated or not) except for the top right hand corner of the page.

If the user is not authenticated, the top right-hand corner of the page displays a "Login" link.

If the user is authenticated, the top right-hand corner of the page displays "Hello, USER_NAME" and a "Logout" link.

What caching strategy would you employ in this situation?

Suppose you have an application with two models, User and Places. A User has many Places and a place denotes a location in the world that a user has visited. Place has two properties string:city and string:country, and User has property string:name.

Somewhere in your site you want to display a list of Users and the most recent Place they have visited. Write an ActiveRecord query to do this.

Now, suppose you have many many Users and Places and to make your SQL more efficient you wish to denormalize your data and add a field int:most_recent_place_id to the User model. How would you go about keeping this field up to date? Write the simplified ActiveRecord query that to display the list of Users and Places.