Shashank Date
2005-Sep-26 21:39 UTC
Re: [ruby-india] HOW TO USE A SINGLE CONTROLLER FOR MORE THAN ONE MODEL
Hi Shashi --- dshashidharreddy <dshashidharreddy-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: <snip>> As per my knowledge ROR allows to create scaffold with the below > command > > 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 > model?<snip> 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'' dependency model exists app/models/ exists test/unit/ exists test/fixtures/ .... .... and then c:\rails_app>ruby script/generate scaffold Salary ''admin/salary'' dependency model exists app/models/ exists test/unit/ exists test/fixtures/ .... .... create app/views/layouts/salary.rhtml overwrite public/stylesheets/scaffold.css? [Ynaq] y force public/stylesheets/scaffold.css .... 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: http://localhost:3000/admin/employee/new and, this for the Salary admin: http://localhost:3000/admin/salary/new I am not a Rails guru, so I am pitching this over to the Rails ML in case someone has a better solution.> ShashiHTH, -- shanko __________________________________ Yahoo! Mail - PC Magazine Editors'' Choice 2005 http://mail.yahoo.com