Forum: Ruby on Rails n00b q - scaffold for multiple models

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
17acfbd3a05cfb59e0543235cc0a813b?d=identicon&s=25 joshua (Guest)
on 2005-12-09 07:48
(Received via mailing list)
Bonk! That's the sound of my head hitting the wall.  I think I've got
a good grasp of Rails, and then I realize I don't understand
something really basic...  I'm bumping up against what to do when
I've got multiple model classes I want to have CRUD actions on.

Imagine I'm building something like a group effort to-do list. Say I
want admin scaffolding with standard CRUD actions for both tasks and
actors.  I know eventually I'll replace the scaffold, but for now
it's a good example to think about.  So how do I arrange things?  Do
I have one AdminController that has a :list action that will list
either Task or Actor entities depending on the URL parameters, or do
I need two different controllers?  Or one controller with different
actions for different model types?  I can figure out how to do it any
of those ways, but I'm not familiar enough with the typical design
patterns for Rails to guess which is the best way to go.

I'm shying away from having a corresponding controller for every
model type, but that's mainly because it seems like the way I think
about the URLs would be weird.  Should URLs describe models or
actions, or both?  Do I want my URL to say /admin/list/task/123, or /
admin/task/list/123, or does it really matter?

thanks mucho,
josh
This topic is locked and can not be replied to.