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

Merge RailsAdmin config #1780

Closed
sepastian opened this issue Oct 4, 2013 · 4 comments
Closed

Merge RailsAdmin config #1780

sepastian opened this issue Oct 4, 2013 · 4 comments

Comments

@sepastian
Copy link

I am developing a gem that installs RailsAdmin into a main application. The gem defines a document type (models) with basic attributes and RailsAdmin configuration. Other (yet to be developed) gems may define additional document types, such as invoice, order, ... - that require different attributes and, consequently, different RailsAdmin configuration.

The basic document type comes as a module, additional document types include the basic document type. If calling rails_admin do ... end multiple times, both in the module and the actual document class, configuration options will be overwritten. How can I merge different RailsAdmin configurations?

I need to be able to to this, for example:

module Base
  extend ActiveSupport::Concern
  included do
    rails_admin do
      parent Document
    end
  end
end

class Invoice
  include Base
  rails_admin do
    navigation_icon 'icon-file'
  end
end

After that, Invoice should have Document defined as its parent in RailsAdmin.

Can RailsAdmin do this? If not, how would I go about implementing this in RailsAdmin in a smart way and without reinventing the wheel?

Thanks...

PS This has been asked before, but never answered.

@ehoch
Copy link
Contributor

ehoch commented Oct 4, 2013

Our hacked solution:

https://gist.github.com/ehoch/6826660

@sepastian
Copy link
Author

Thanks a lot Eric, looking good.

I am preparing a pull request containing small modifications to RailsAdmin::Config::LazyModel and RailsAdmin::Config. Will probably post it here later today.

@sepastian
Copy link
Author

Pull request #1781

@mshibuya
Copy link
Member

mshibuya commented Sep 3, 2016

#2670 made it possible.

@mshibuya mshibuya closed this as completed Sep 3, 2016
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