Module: RailsAdmin::Config::Sections

Included in:
Model
Defined in:
lib/rails_admin/config/sections.rb,
lib/rails_admin/config/sections/base.rb,
lib/rails_admin/config/sections/edit.rb,
lib/rails_admin/config/sections/list.rb,
lib/rails_admin/config/sections/show.rb,
lib/rails_admin/config/sections/modal.rb,
lib/rails_admin/config/sections/create.rb,
lib/rails_admin/config/sections/export.rb,
lib/rails_admin/config/sections/nested.rb,
lib/rails_admin/config/sections/update.rb

Overview

Sections describe different views in the RailsAdmin engine. Configurable sections are list and navigation.

Each section’s class object can store generic configuration about that section (such as the number of visible tabs in the main navigation), while the instances (accessed via model configuration objects) store model specific configuration (such as the visibility of the model).

Defined Under Namespace

Classes: Base, Create, Edit, Export, List, Modal, Nested, Show, Update

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rails_admin/config/sections.rb', line 22

def self.included(klass)
  # Register accessors for all the sections in this namespace
  constants.each do |name|
    section = RailsAdmin::Config::Sections.const_get(name)
    name = name.to_s.underscore.to_sym
    klass.send(:define_method, name) do |&block|
      @sections = {} unless @sections
      @sections[name] = section.new(self) unless @sections[name]
      @sections[name].instance_eval(&block) if block
      @sections[name]
    end
  end
end