Sha256: 2b50fc58cd21a2a78897d6be3b49b8b02a57ff9765c8312286582ea5c2a26efd

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 Bytes

Contents

require 'rails_admin/config/fields/group'

module RailsAdmin
  module Config
    module Fields
      module Groupable
        # 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 RailsAdmin::Config::HasGroups.group
        # @see RailsAdmin::Config::Fields::Group
        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
obitum-rails_admin-0.0.2 lib/rails_admin/config/fields/groupable.rb
obitum-rails_admin-0.0.1 lib/rails_admin/config/fields/groupable.rb
elucid-rails_admin-0.0.1 lib/rails_admin/config/fields/groupable.rb