Related link: http://dereksivers.com/rails-shared-controller.html
In Ruby on Rails, I was doing a lot of similar actions/views/methods on a bunch of different tables. So I put them all in one controller at the end of application.rb
Now the similar controllers just inherit from that one. Just tell the shared-controller what Model to use.
EVEN MY VIEWS could be shared, if I could just let the model tell the shared-view what form-bits to include. Kinda like Rails’ generator does.
To do this I came up with the form “Nub” (one form entry) - which can give the info unique to that form field. An array of Nubs is created in the model.
Anyway, I put the gist of it here, for the taking:
http://dereksivers.com/rails-shared-controller.html
Sorry there’s not more explanation. Lots of work I’m excited about, and no time to stop and teach. (Even putting that page together took an hour, so I hope someone can use it!)
:-)
- Derek


extending scaffolding
Someone pointed out that extending scaffolding in Rails would have been a similar approach:
http://wiki.rubyonrails.com/rails/show/HowToExtendScaffolding (http://wiki.rubyonrails.com/rails/show/HowToExtendScaffolding)