Note that there are some explanatory texts on larger screens.

plurals
  1. POGive a detailed illustration of how the MVC works in Rails, and how the controller communicates with forms etc?
    text
    copied!<p>Perhaps this can even become a Community Wiki, but I would love a detailed description of how the controller works - or rather, how I can get it to do what I want it to do.</p> <p>I understand the general structure of MVC and how the model stores the db structure, and the controller interacts with the db and passes info to the view.</p> <p>However, I am puzzled (on a fundamental level) about how to accomplish simple tasks using my controller. I know that if I want to create a new record for a model/object, I just do <code>object = Object.new(:name =&gt; "Object Name")</code> in the Rails console.</p> <p>But how on earth would I do that in the CRUD elements of the controller and why?</p> <p>Please use a simple example - e.g. showing a user the balance of their bank account (I know there are many complexities surrounding this, but ignore them for the sake of this explanation). What would the model look like (just include: Name, Address, Transaction Type (Deposits/Withdrawals), Balance).</p> <p>What would a view look like? What would the controller look like? Any choices you make (like using a form) please explain them. Why would you use a form, as opposed to a drop down menu and (in layman terms) how does the form or drop down menu interact with the controller? How do I get the info captured there to the db and why am I doing it that way?</p> <p>I know this sounds like a lot to ask, but I have done RailsTutorial.org, watched many Railscasts, read the Rails guides, and read many other tutorials and still have some basic gaps in my understanding of the way Rails works and why.</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload