Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override inherited_resources with the rails scaffold command

I am using the active_admin gem in my Rails 3 application, which has as a dependency inherited_resources. I am somewhat of a newb and would rather avoid the black box qualities of inherited_resources for my own controllers, however, when I run the default rails g scaffold command, the controllers that are generated are inheriting from inherited_resources. I know that I can manually override this by inheriting from ApplicationController, however, I would like to be able to generate the default rails scaffolds if possible.

like image 364
lightyrs Avatar asked Jun 05 '11 23:06

lightyrs


People also ask

What does rails g scaffold do?

Rails scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.

How do you remove scaffold in rails?

You can remove scaffold in the following way: Generate scaffold: $rails generate scaffold Story. If you migrated your files, perform a rollback: $rake db:rollback. Destroy or undo scaffold: $rails destroy scaffold Story.


1 Answers

-c=scaffold_controller

or add this to config/application.rb

config.generators do |g|
  g.scaffold_controller "scaffold_controller"
end
like image 112
nigelr Avatar answered Nov 02 '22 23:11

nigelr