Module: Formed::Associations::ForeignAssociation
- Included in:
- HasManyAssociation, HasOneAssociation
- Defined in:
- lib/formed/associations/foreign_association.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#foreign_key_present? ⇒ Boolean
6 7 8 9 10 11 12 |
# File 'lib/formed/associations/foreign_association.rb', line 6 def foreign_key_present? if reflection.klass.primary_key owner.attribute_present?(reflection.active_record_primary_key) else false end end |
#nullified_owner_attributes ⇒ Object
14 15 16 17 18 19 |
# File 'lib/formed/associations/foreign_association.rb', line 14 def nullified_owner_attributes {}.tap do |attrs| attrs[reflection.foreign_key] = nil attrs[reflection.type] = nil if reflection.type.present? end end |