Hi all - I''m trying to wrap my head around the scaffold command and am not sure what the best practice is for what I''m trying to do. I want to have my scaffold command create all the files for me which works fine but I also want all the the admin views and controllers to be in a module of say "admin" rather then at the top level of my app. I''m imagining a setup like: app/controllers/admin/admin_state_province_controller.rb app/controllers/state_province_controller.rb app/views/state_provinces/admin/_form.rhtml app/views/state_provinces/_form.rhtml But I can''t seem to figure out a) if this is a "bad" idea (i.e., not the rails way to do things) b) if it''s not a bad idea how to make the incantation work. Thanks for any help. Mike
Check out the help: /script/generate scaffold Example: ./script/generate scaffold CreditCard ''admin/credit_card'' suspend late_fee will place the controller/view inside admin module. On 11/5/05, Michael Engelhart <moosebrookfarm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all - > > I''m trying to wrap my head around the scaffold command and am not sure > what the best practice is for what I''m trying to do. > > I want to have my scaffold command create all the files for me which > works fine but I also want all the the admin views and controllers to > be in a module of say "admin" rather then at the top level of my app. > > > I''m imagining a setup like: > > app/controllers/admin/admin_state_province_controller.rb > app/controllers/state_province_controller.rb > > app/views/state_provinces/admin/_form.rhtml > app/views/state_provinces/_form.rhtml > > But I can''t seem to figure out > a) if this is a "bad" idea (i.e., not the rails way to do things) > b) if it''s not a bad idea how to make the incantation work. > > Thanks for any help. > > Mike > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thanks cuong. Actually the reason I posted was because I googled and looked around in my rails setup and couldn''t find any documentation for the ''generate'' command. I tried generate --help and no joy either. Is there standalone documentation for it? THanks Mike On 11/5/05, Cuong Tran <cuong.tran-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Check out the help: > /script/generate scaffold > > Example: > ./script/generate scaffold CreditCard ''admin/credit_card'' suspend late_fee > > will place the controller/view inside admin module. > > On 11/5/05, Michael Engelhart <moosebrookfarm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi all - > > > > I''m trying to wrap my head around the scaffold command and am not sure > > what the best practice is for what I''m trying to do. > > > > I want to have my scaffold command create all the files for me which > > works fine but I also want all the the admin views and controllers to > > be in a module of say "admin" rather then at the top level of my app. > > > > > > I''m imagining a setup like: > > > > app/controllers/admin/admin_state_province_controller.rb > > app/controllers/state_province_controller.rb > > > > app/views/state_provinces/admin/_form.rhtml > > app/views/state_provinces/_form.rhtml > > > > But I can''t seem to figure out > > a) if this is a "bad" idea (i.e., not the rails way to do things) > > b) if it''s not a bad idea how to make the incantation work. > > > > Thanks for any help. > > > > Mike > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >