Skip to content

any way to permit 'rails scaffold' to work normally if inherited_resources used by another gem? #195

Closed
jpwynn opened this Issue Jan 19, 2012 · 9 comments

5 participants

@jpwynn
jpwynn commented Jan 19, 2012

I installed ActiveAdmin, which uses InheritedResources, which now means when I try to generate plain old rails scaffolding, it does not create CRUD actions and creates a controller based on InheritedResources.

For those of us who need the ability to create normal rails scaffolds, is there a way to have inherited_resources NOT override the default scaffolding when we manually scaffold new models?

@carlosantoniodasilva
Collaborator

This is how InheritedResources changes this configuration.

You should be able to do the same in your app, configuring back to the default :scaffold_controller, by adding this to your application.rb file:

config.app_generators.scaffold_controller = :scaffold_controller

That should work.

@jpwynn
jpwynn commented Jan 19, 2012

Though that did not work. I tried adding

config.app_generators.scaffold_controller = :scaffold_controller

to config/application.rb, then to config/environments/development.rb. In both cases, running 'rails g scaffold' produced the same empty controller with a class based on InheritedResources::Base instead of ApplicationController

@jpwynn
jpwynn commented Jan 19, 2012

here is something that does work, although it would be much better to change the setting once in a config file per your suggestion, if we can find the right setting. But for a manual override, this works:

rails g scaffold Foobar name:string -c=scaffold_controller

If anyone knows how to revert to scaffold_controller being the default, please chime in.

@carlosantoniodasilva
Collaborator

Weird, setting the config in your application should have worked fine. Could you please send which Rails and IR (or ActiveAdmin) version you're using?

@jpwynn
jpwynn commented Jan 19, 2012

I have rails 3.1.3, IR gem 1.2.2, activeadmin gem 0.3.4, running on windows xp sp3, doing everything via bash shell. rake is 0.8.7.

@jontonsoup

Bump. I am having the same issue.

@zetachang

It seemed fixed now. Using rails 3.2.1 , activeadmin 0.4.0. Add the line to application.rb got it fixed.

@jontonsoup

Thanks. I was using rails 3.1.x. Upgrading fixed it.

@rdetert
rdetert commented Mar 27, 2014

In Rails 4 this still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.