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.
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.
A request.xhr tells the controller that the new Ajax request has come, It always return Boolean values (TRUE or FALSE).
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:
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.
There are lot of things you can define in models few are:
- Validations (like validates_presence_of, numeracility_of, format_of etc.)
- Relationships(like has_one, has_many, HABTM etc.)
- Callbacks(like before_save, after_save, before_create etc.)
- Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model
- ROR Queries in Sql
- Active record Associations Relationship