8

SOLUTION FOUND: See comment

Building a new rails 3.1 app. Started with a basic blog_entries model to get the hang of it. No surprises.

Then I added ActiveAdmin, got that working okay with my existing model.

But now when I try to scaffold a new model/etc with this:

rails g scaffold Community name:string guid:string

everything seems right (views, migration) except the controller does not have CRUD options and looks like this:

class CommunitiesController < InheritedResources::Base
end

The problem is that ActiveAdmin uses inherited_resources which prevents manual rails scaffolding from working normally.

Does anyone know a way to force rails to scaffold "correctly" despite ActiveAdmin using inherited_resources?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
jpw
  • 18,697
  • 25
  • 111
  • 187
  • found a reference to the -c command line argument for 'rails generate scaffold'. To force rails to use the normal scaffold generator, add -c=scaffold_generator to the end of the command – jpw Jan 19 '12 at 01:56
  • 3
    oops: -c=scaffold_controller (not _generator) – jpw Jan 20 '12 at 07:20
  • I'm having the same issue... Using the -c part at the end has no effect: http://stackoverflow.com/questions/8946980/running-rails-generate-scaffold-does-not-generate-model – Alex Jan 20 '12 at 19:52
  • 1
    can't explain that, it worked perfectly for me: rails g scaffold ETC ETC ETC -c=scaffold_controller – jpw Jan 23 '12 at 00:43

1 Answers1

11

You can do the following to override inherited_resources:

-c=scaffold_controller
Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
jpw
  • 18,697
  • 25
  • 111
  • 187