Class: SmartEnum::Associations::ThroughAssociation
- Inherits:
-
Object
- Object
- SmartEnum::Associations::ThroughAssociation
- Defined in:
- lib/smart_enum/associations.rb
Instance Attribute Summary collapse
-
#association_name ⇒ Object
readonly
Returns the value of attribute association_name.
-
#source_option ⇒ Object
readonly
Returns the value of attribute source_option.
-
#through_association ⇒ Object
readonly
Returns the value of attribute through_association.
Instance Method Summary collapse
- #association_method ⇒ Object
-
#initialize(association_name, through_association, source: nil) ⇒ ThroughAssociation
constructor
A new instance of ThroughAssociation.
Constructor Details
#initialize(association_name, through_association, source: nil) ⇒ ThroughAssociation
Returns a new instance of ThroughAssociation.
145 146 147 148 149 |
# File 'lib/smart_enum/associations.rb', line 145 def initialize(association_name, through_association, source: nil) @association_name = association_name @through_association = through_association.to_sym @source_option = source end |
Instance Attribute Details
#association_name ⇒ Object (readonly)
Returns the value of attribute association_name.
143 144 145 |
# File 'lib/smart_enum/associations.rb', line 143 def association_name @association_name end |
#source_option ⇒ Object (readonly)
Returns the value of attribute source_option.
143 144 145 |
# File 'lib/smart_enum/associations.rb', line 143 def source_option @source_option end |
#through_association ⇒ Object (readonly)
Returns the value of attribute through_association.
143 144 145 |
# File 'lib/smart_enum/associations.rb', line 143 def through_association @through_association end |
Instance Method Details
#association_method ⇒ Object
151 152 153 |
# File 'lib/smart_enum/associations.rb', line 151 def association_method @association_method ||= (source_option || association_name) end |