On Oct 10, 5:34 am, Chirantan <[EMAIL PROTECTED]> wrote: > This question is more about how things work in an MVC architecture > based ORM application. I want to know which controller to write code > into when there is a many to many relationship between 2 models. > > Example, > > I have a model A and model B with respective controllers and have a > many to many realastionship. I want to list Bs that are associated > with A in using bridge table. Which controller should the code for > this go since both are equally related. > > Chirantan
Hi Chirantan. Controller methods generally map to actions that are performed on models. So a method named "new" in the User model would allow you to create a new User. In other words, if you want to do something to ModelA, you'd put the method in ModelA's controller. To answer your question, if I wanted to list all Bs associated with a particular A, I would probably create a method in the A controller called "list_Bs". Hope that helps, Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

