Class: Calagator::DuplicateChecking::DuplicateSquasher::SingleSquasher
- Inherits:
-
Struct
- Object
- Struct
- Calagator::DuplicateChecking::DuplicateSquasher::SingleSquasher
- Defined in:
- lib/calagator/duplicate_checking/duplicate_squasher.rb
Instance Attribute Summary collapse
-
#duplicate ⇒ Object
Returns the value of attribute duplicate.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#primary ⇒ Object
Returns the value of attribute primary.
Instance Method Summary collapse
Instance Attribute Details
#duplicate ⇒ Object
Returns the value of attribute duplicate
33 34 35 |
# File 'lib/calagator/duplicate_checking/duplicate_squasher.rb', line 33 def duplicate @duplicate end |
#model_name ⇒ Object
Returns the value of attribute model_name
33 34 35 |
# File 'lib/calagator/duplicate_checking/duplicate_squasher.rb', line 33 def model_name @model_name end |
#primary ⇒ Object
Returns the value of attribute primary
33 34 35 |
# File 'lib/calagator/duplicate_checking/duplicate_squasher.rb', line 33 def primary @primary end |
Instance Method Details
#squash ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/calagator/duplicate_checking/duplicate_squasher.rb', line 34 def squash # Transfer any venues that use this now duplicate venue as a primary if duplicate.duplicates.any? DuplicateSquasher.new(primary, duplicate.duplicates, model_name).squash end squash_associations duplicate.update_attribute(:duplicate_of, primary) duplicate end |