Hello. I'm coming from a non MVC background, mainly C and PHP - I'm wondering how the Controllers and RESTful framework deal with this:
In PHP, a URL would have both a view and an action in them, such as:
..which tells the app what view we're in, and what's the action.
but in RoR it's
..does this mean that I need as many controllers as pages?
How do you usually deal with this? how does the controller know which view to display? Seeing as a similar action could come from several different views?
The controller is the class. The action is the class methods. So, in general, you would need as many methods for the class "controller" as actions. From there you can refactor simple and/or repetitive actions.
I understand that, but say for example, I would like to have a view which has both listing and editing, how is the controller set up?
Or say I have a view which displays several different Models, does that mean I should have one controller per view? But if that's the case, won't I have repeated code if there are several places to edit/view the same data?