Topic: Rails beginner question: how do i structure controller?
Just starting out with RoR and am very eager to move past the basic example apps on all the Web tutorials...
I am unclear though on how to structure something though in Rails:
Let's say I want to create a Web app that allows people to select one of many accounts. Once an account is selected, they are then taken to a screen where are the associated expenses for that account are listed. The user can go through the typical add/edit/delete for those expenses (linked to this account via FK).
So let's say, I have two models, Account and Expense.
Should I create two separate controllers, one for each? If so, how do I keep in context the ID of the Account that I am currently working on (outside of using sessions)?
Is there a way to pass the ID param so that a "subcontroller" is somehow utilized, like maybe:
http://localhost:3000/Accounts/13/Expenses/show/5 ("Show Expense with ID 5 which is tied to Account 13")?
If so, how do I implement this? If not, how should I be structuring this?
Thanks in advance for everyone's help.