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?