Explain about ruby names?

Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make sure that you follow the name by name characters.

What is Session and Cookies?

Session: are used to store user information on the server side.
cookies: are used to store information on the browser side or we can say client side
Session : say session[:user] = "Alex" it remains when the browser is not closed.

What is request.xhr?

A request.xhr tells the controller that the new Ajax request has come, It always return Boolean values (TRUE or FALSE).

What is MVC? and how it Works?

MVC tends for Model-View-Controller, used by many languages like PHP, Perl, Python etc. The flow goes like this: Request first comes to the controller, controller finds and appropriate view and interacts with model, model interacts with your database and send the response to controller then controller based on the response give the output parameter to view, for Example your url is something like this: http://localhost:3000/users/new
here users is your controller and new is your method, there must be a file in your views/users folder named new.html.erb, so once the submit button is pressed, User model or whatever defined in the rhtml form_for syntax, will be called and values will be stored into the database.

What are the things we can define in the model?

There are lot of things you can define in models few are:

  1. Validations (like validates_presence_of, numeracility_of, format_of etc.)
  2. Relationships(like has_one, has_many, HABTM etc.)
  3. Callbacks(like before_save, after_save, before_create etc.)
  4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model
  5. ROR Queries in Sql
  6. Active record Associations Relationship