sferik/rails_admin — pull request #1781 by sepastian (2013-10-04 16:14:37+00:00)
Title: Allow multiple config blocks for a single resource in RailsAdmin

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` and `RailsAdmin::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`) :

# app/models/some_model.rb
class SomeModel
rails_admin do
:
end
end

# config/initializers/rails_admin.rb
config.model SomeModel do
:
end

After applying this pull request, the settings defined in `config/initializers/rails_admin.rb` will evaluate before the ones found in `SomeModel`. The settings from `config/initializers/rails_admin.rb` will be maintained, although `SomeModel` may chose to overwrite some settings.