Home / Interview / Rails :: General Questions

Interview :: Rails

11)

What is Active Record in Rails?

A perfect ORM hides the details of a database's relational data behind the object hierarchy. In Rails, ORM is implemented by Active Record which is one of the most critical components of the Rails library.

While using Active Record, you have to no longer deal with database constructs like tables, rows or columns. Your application only deals with classes, attributes, and objects.

12)

Who designed Active Record in Rails?

Active Record is based on a design pattern created by Martin Fowler. From this design pattern only, the Active Record got its name. Its code works very well even with less number of lines. It is quite easy to use. Active Record Rails application does not need any configuration at all if proper naming schemes are followed in your database and classes.

13)

Explain model in Rails?

The models are classes in Rails. This subsystem is implemented in ActiveRecord library. This library provides an interface between database tables and Ruby program code that manipulates database records.

14)

Which command is used to create a migration?

15)

Explain the role of 'defined' operator?

The 'defined' operator is used to check whether the expression passed has been defined or not.

16) What is the purpose of the super call?

When we make a call to super, the parent method which has the same arguments as child one is invoked.

17)

Write the syntax of each iterator?

The syntax of each iterator is

18) How are blocks created?

The syntax for creation of block is:

19) What is the naming convention for variables?

The name of the variable is given in the lower case, and an underscore separates the different words within the name.

20) What is the main difference between procs and blocks?

Procs are objects whereas Blocks are a part of the code.