-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Allow multiple config blocks for a single resource in RailsAdmin #1781
Allow multiple config blocks for a single resource in RailsAdmin #1781
Conversation
…/initializers evaluate before blocks defined in app/models
Hi, I am trying to run the RA rspec test suite, but bundler keeps complaining about my adapter specification. What is required in terms of database settings to get rspec up and running?
|
@sepastian it looks as if you need to run "bundle install" to install the mongoid gem from git. |
Others already had this problem as well, including me. I am not exactly sure which step made it finally work, but I tried with this: https://github.com/bundler/bundler/blob/master/ISSUES.md#other-problems |
Closing this as stalled. Please reopen and rebase if you still want to add it. Some tests would definitely be needed as well for such a feature. |
…rns and models. Based on railsadminteam#1781
…rns and models. Based on railsadminteam#1781
* feature/allow_multiple_configuration_blocks: Correct behavior of LazyModel with multiple blocks. Add specs. Add opportunity for chain of configuration from initializers to concerns and models. Based on railsadminteam#1781
When using RailsAdmin within another gem, it should be possible to spread out and merge configuration blocks for a single resource across initializers and models, in an attempt to produce DRY code.
Currently, RailsAdmin allows multiple configuration blocks for a single resource, however, blocks evaluating later will overwrite earlier blocks.
This pull requests contains two small changes to
RailsAdmin::Config::LazyModel
andRailsAdmin::Config
, to implement multiple configuration blocks for a single resource.For example, in the current version of RailsAdmin, these two blocks would overwrite each other - depending on the exact order of loading (see comment in
lib/rails_admin/config/lazy_model.rb
) :After applying this pull request, the settings defined in
config/initializers/rails_admin.rb
will evaluate before the ones found inSomeModel
. The settings fromconfig/initializers/rails_admin.rb
will be maintained, althoughSomeModel
may chose to overwrite some settings.