Class: Polymorpheus::InterfaceBuilder::Association

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Inflector
Defined in:
lib/polymorpheus/interface_builder/association.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Association

Returns a new instance of Association.



11
12
13
14
# File 'lib/polymorpheus/interface_builder/association.rb', line 11

def initialize(name, options)
  @name, @options = name.to_s.downcase, options
  @key = "#{@name}_id"
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/polymorpheus/interface_builder/association.rb', line 7

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/polymorpheus/interface_builder/association.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/polymorpheus/interface_builder/association.rb', line 7

def options
  @options
end

Instance Method Details

#association_classObject

The association class may not be loaded at the time this object is initialized, so we can’t set it via an accessor in the initializer.



18
19
20
# File 'lib/polymorpheus/interface_builder/association.rb', line 18

def association_class
  @association_class ||= name.classify.constantize
end