Re: [ruby-india] HOW TO USE A SINGLE CONTROLLER FOR MORE THAN ONE MODEL
- Hi Shashi
--- dshashidharreddy <dshashidharreddy@...> wrote:
> As per my knowledge ROR allows to create scaffold with the below<snip>
> c:\>ruby script/generate scaffold Employee Admin
> here Employee as Model and Admin as controller.
> Now my doubt is how can I use the same Admin Controller for Salary
I do not know of a way to generate "the same Admin Controller" for another model.
But you can always have two different controllers (and then manually merge them somehow):
c:\rails_app>ruby script/generate scaffold Employee 'admin/employee'
c:\rails_app>ruby script/generate scaffold Salary 'admin/salary'
overwrite public/stylesheets/scaffold.css? [Ynaq] y
Note that you have to be careful with it trying to overwrite scaffold.css if you have modified it
in any way. Doing it this way will allow you to do the following for the Employee admin:
and, this for the Salary admin:
I am not a Rails guru, so I am pitching this over to the Rails ML in case someone has a better
Yahoo! Mail - PC Magazine Editors' Choice 2005