Class: Polymorpheus::InterfaceBuilder::Association
- Inherits:
-
Object
- Object
- Polymorpheus::InterfaceBuilder::Association
- Includes:
- ActiveSupport::Inflector
- Defined in:
- lib/polymorpheus/interface_builder/association.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#association_class ⇒ Object
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.
-
#initialize(name, options) ⇒ Association
constructor
A new instance of Association.
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, ) @name, @options = name.to_s.downcase, @key = "#{@name}_id" end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/polymorpheus/interface_builder/association.rb', line 7 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/polymorpheus/interface_builder/association.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/polymorpheus/interface_builder/association.rb', line 7 def @options end |
Instance Method Details
#association_class ⇒ Object
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 |