Schedule a 30 minute appointment with a client advisor today. Start
Engineering, Design, Marketing, and More

Ruby on Rails interview questions

The most popular questions

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Get a question answered
Punch offers four divisions of services: design, engineering, staffing, and demand

Interview questions for your next interview

Question
What is MVC?
Answer
Model-View-Controller (MVC) is a design pattern for structuring software applications. The MVC pattern separates application logic from the user interface. MVC stands for Model, View, and Controller, the three main components of the MVC application architecture. The Model is a layer between a database and an application that stores business logic related to a specific entity. A View is a visualization of the attached Model state. And controllers are responsible for accepting requests, finding appropriate actions and returning responses back.
Question
What is ORM in Rails?
Answer
ORM is Object-Relationship-Model. It means that data model Classes are mapped to appropriate tables in the application database. And Objects are directly mapped to the rows in the table.

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
What is Ruby Gems?
Answer
It's a package manager in Ruby. It allows you to easily download, install and manage gems on your application.
Question
What things we can define in the Rails model?
Answer
There are lot of things you can define in models. For example:
  • Model properties and primary key
  • Validation rules
  • Relationships with other models like: "one to one", "one to many" and "many to many"
  • Callbacks
  • Custom database queries
Question
What is the difference between -%> and %> in Rails?
Answer
The extra dash makes ERB not output the newline after the closing tag.
Question
What are helpers and how to use helpers in Rails?
Answer
Helpers (“view helpers”) are modules that provide methods which are automatically usable in your view. They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views.
Question
What is bundler in Rails?
Answer
Bundler is a new concept introduced in Rails3, which helps to you manage your gems for the application. After specifying gems in your Gemfile, you need to do a bundle install.
Question
What is migrations in Rails?
Answer
Migrations is organized way to manage database changes. Migrations are stored in files as special classes which allows to keep track of them in a repository. Miagrations also allow to manage database of different enviroments like production, staging, testing, development etc. Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate
Question
What is the difference between form_for and form_tag?
Answer
form_tag and form_for both are used to submit the form and it’s elements. The main difference between these two is the way of managing objects related to that particular model is different. You should use “form_for” tag for a specific model. And form_tag creates a form as a normal form without any model backed and has normal fields.
Question
What is scaffolding in Rails?
Answer
Scaffolding in Ruby on Rails refers to the auto generation of a simple set of a model, views and controller usually for a single table.

For example:rails generate scaffold UserThis will create a full CRUD (create, read, update, delete) web interface for the Users table.

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
How to use nested routes in Rails?
Answer
The easiest way to create a nested route, is to use the :has_many keyword like that:# /config/routes.rb
map.resources :categories, :has_many => :products

# and the correspondent project resource
map.resources :projects
Question
What is observer in in Rails?
Answer
If you want to observe changes in model attibutes and respond to those changes it's recommended to use a separate Observer class. Model specific event handling is much cleaner this way and will avoid models from polluting the model by un-necessary methods.

Ask a question

Ask a question, and one of our engineers will answer it.

We keep our questions nice and simple to be useful for everyone, and we may not answer or publish every question.

Your number is stored privately and never shared.
By submitting a question, you agree to our terms.
Request sent. Thank you!
Send another one