Skip to content

Merge RailsAdmin config #1780

@sepastian

Description

@sepastian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions