Class: RailsAdmin::Config::Sections::Base

Inherits:
Object
  • Object
show all
Includes:
Configurable, HasDescription, HasFields, HasGroups, Proxyable
Defined in:
lib/rails_admin/config/sections/base.rb

Overview

Configuration of the show view for a new object

Direct Known Subclasses

Edit, Export, List, Show

Instance Attribute Summary collapse

Attributes included from HasDescription

#description

Attributes included from Proxyable

#bindings

Instance Method Summary collapse

Methods included from HasDescription

#desc

Methods included from HasGroups

#group, #visible_groups

Methods included from HasFields

#_fields, #all_fields, #configure, #exclude_fields, #field, #fields, #fields_of_type, #include_all_fields, #include_fields, #visible_fields

Methods included from Configurable

#has_option?, #register_deprecated_instance_option, #register_instance_option

Methods included from Proxyable

#with

Constructor Details

#initialize(parent) ⇒ Base

Returns a new instance of Base


22
23
24
25
26
27
# File 'lib/rails_admin/config/sections/base.rb', line 22

def initialize(parent)
  @parent = parent
  @root = parent.root

  @abstract_model = root.abstract_model
end

Instance Attribute Details

#abstract_modelObject (readonly)

Returns the value of attribute abstract_model


19
20
21
# File 'lib/rails_admin/config/sections/base.rb', line 19

def abstract_model
  @abstract_model
end

#parentObject (readonly)

Returns the value of attribute parent


20
21
22
# File 'lib/rails_admin/config/sections/base.rb', line 20

def parent
  @parent
end

#rootObject (readonly)

Returns the value of attribute root


20
21
22
# File 'lib/rails_admin/config/sections/base.rb', line 20

def root
  @root
end

Instance Method Details

#inspectObject


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/rails_admin/config/sections/base.rb', line 29

def inspect
  "#<#{self.class.name} #{
    instance_variables.collect do |v|
      value = instance_variable_get(v)
      if [:@parent, :@root, :@abstract_model].include? v
        if value.respond_to? :name
          "#{v}=#{value.name.inspect}"
        else
          "#{v}=#{value.class.name}"
        end
      else
        "#{v}=#{value.inspect}"
      end
    end.join(', ')
  }>"
end