Class: SmartEnum::Associations::HasAssociation
- Inherits:
-
Association
- Object
- Association
- SmartEnum::Associations::HasAssociation
- Defined in:
- lib/smart_enum/associations.rb
Instance Attribute Summary
Attributes inherited from Association
#as_option, #association_name, #class_name_option, #foreign_key_option, #owner_class
Instance Method Summary collapse
Methods inherited from Association
#association_class, #class_name, #generated_method_name, #initialize
Constructor Details
This class inherits a constructor from SmartEnum::Associations::Association
Instance Method Details
#foreign_key ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/smart_enum/associations.rb', line 129 def foreign_key @foreign_key ||= begin return foreign_key_option.to_sym if foreign_key_option if owner_class.name SmartEnum::Utilities.foreign_key(owner_class.name).to_sym else raise "You must specify the foreign_key option when using a 'has_*' association on an anoymous class" end end end |