Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.parent_controller setting does not work #2790

Closed
grillermo opened this issue Dec 9, 2016 · 2 comments
Closed

config.parent_controller setting does not work #2790

grillermo opened this issue Dec 9, 2016 · 2 comments
Milestone

Comments

@grillermo
Copy link

grillermo commented Dec 9, 2016

On my project the config/initializers/rails_admin.rb file added

config.parent_controller = '::MyBaseController'

And rails admin ignores it, if i change directly the lib/rails_admin/config.rb file and hardcode this

@parent_controller = '::MyBaseController

It works, my conclusion is that this mechanism

class ApplicationController < Config.parent_controller.constantize

Doesnt work.
I tested it using a before_action filter and i could confirm that doing

self.class.superclass

Does not return the right class when using the config approach.

@tamaloa
Copy link

tamaloa commented Jan 6, 2017

Had a similar problem when trying to set config.parent_controller = '::ApplicationController' to keep the old behaviour.
Could fix it by moving the config.parent_controller setting above my config.audit_with call. Try moving it to the very beginning of the config block. I guess some config calls instantiate the controller so that the setting later takes no effect anymore.

@grillermo
Copy link
Author

Will try that, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants