Posts

Showing posts from October, 2012

Rails Tricks

Image
1.  What is request.xhr ? Ans: A request.xhr tells the controller that the new  Ajax  request has come, It always return Boolean    values (TRUE or FALSE) 2.  What is MVC? and how it Works?   Ans:  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. 3 . What things we can define in the model?   Ans: There are lot of