Class: ActiveAdminAssociations::AssociationConfig::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin_associations/association_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, fields = [], &block) ⇒ Association

Returns a new instance of Association.



9
10
11
12
13
# File 'lib/active_admin_associations/association_config.rb', line 9

def initialize(name, fields = [], &block)
  @name = name.to_sym
  @fields = fields
  instance_exec(&block) if block_given?
end

Instance Attribute Details

#fields(*names) ⇒ Object (readonly)

Returns the value of attribute fields.



7
8
9
# File 'lib/active_admin_associations/association_config.rb', line 7

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/active_admin_associations/association_config.rb', line 6

def name
  @name
end

Instance Method Details

#field(name) ⇒ Object



15
16
17
# File 'lib/active_admin_associations/association_config.rb', line 15

def field(name)
  @fields << name
end