Module: RailsAdmin::Config::Fields::Groupable

Defined in:
lib/rails_admin/config/fields/groupable.rb

Class Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object

Register a group instance variable and accessor methods for objects extending the has groups mixin. The extended objects must implement reader for a parent object which includes this module.

See Also:



13
14
15
16
17
18
19
20
21
# File 'lib/rails_admin/config/fields/groupable.rb', line 13

def self.extended(obj)
  obj.instance_variable_set("@group", obj.parent.group(:default))
  class << obj
    def group(name = nil)
      @group = parent.group(name) unless name.nil?
      @group
    end
  end
end