Ruby On Rails Interview Questions And Answers

ruby on rails interview questions and answers   Top 15 Ruby On Rails Interview Questions And Answers

1) What is Ruby?

● It is high level programming language
● Interpreted language
● Object oriented language


2) What is embedded Ruby?

It is also know as ERB which allows to put code in the HTML. It reads the code one by one.

To execute ruby code use <% %> and for output use <%= %>


3) What is Rails?

● Its productive web-application framework.
● Web application id 10 times faster then other typical frameworks.
● No compilation phase needed.


4) What are the different environments provided by Rails?

These are the three default environments that Rails gives:
● Development environment
● Test environment
● Production environment


5) What is Rakefile in the directory structure of the Rails?

This helps in building, packaging and testing the rails code.


6) What is Rubydoc?

It's a Ruby framework which automatically creates documentation for your code.


7) What is Rails Active Record?

● It has Object Relational Mapping(ORM).
● It provides binding between tables and database.
● It follows CRUD methods.


8) Rails Active Record supports which all associations?

Following are the associations:
● one-to-one
● one-to-many
● many-to-many


9) In Rails model what is validates_presence_of validation?

It protects "NOT NULL" fields for missing user inputs.


10) In Rails model what is validates_numericality_of?

It allows only numeric data.


11) What is Rails Migration?

It allows to define changes to your database schema, provides version control which is eventually helpful in synchronizing.


12) In Rails which all are the basic data types supported by Migrations?

Following is the list of datatypes:
● string
● text
● integer
● float
● timestamp
● boolean


13) What all can be done using Rails migration?

Following things can be done using rails migration:
● create_table
● drop_table
● rename_table
● add_column
● rename_column
● add_index
● remove_index


14) How to create Rails migration?

rails generate migration table_name


15) What is Rails controller?

● It handles the interaction between the user, view and model.
● Also it route the requests to the actions.
● It manages caching and sessions.