It might even become a Community Wiki, but I would like a detailed description of how the controller works, or rather, how I can get it to do what I want.
I understand the general structure of MVC and how the model stores the db structure, and the controller interacts with db and passes the information to the view.
However, I am puzzled (at a fundamental level) about how to perform simple tasks using my controller. I know that if I want to create a new entry for a model / object, I just do it object = Object.new(:name => "Object Name")in the Rails console.
But how would I do this in the elements of a CRUD controller and why?
Please use a simple example - for example, showing the user the balance of their bank account (I know that there are many difficulties around this, but ignore them for the sake of this explanation). What the model looks like (just indicate: name, address, type of transaction (deposits / withdrawals), balance).
What will be the view? What would a controller look like? Any choices you make (for example, using the form), please explain them. Why are you using a form and not a drop-down menu and (under the conditions of a layman) how the form or drop-down menu interact with the controller? How can I get the information written there in db, and why am I doing this?
, , , , RailsTutorial.org, Railscasts, Rails , Rails .
.