Class: Reflections::Remappers::HasAndBelongsToMany
- Inherits:
-
Reflections::Remapper
- Object
- Reflections::Remapper
- Reflections::Remappers::HasAndBelongsToMany
- Defined in:
- lib/reflections/remappers/has_and_belongs_to_many.rb
Constant Summary
Constants inherited from Reflections::Remapper
Reflections::Remapper::REMAPPERS
Instance Attribute Summary
Attributes inherited from Reflections::Remapper
Instance Method Summary collapse
Methods inherited from Reflections::Remapper
Constructor Details
This class inherits a constructor from Reflections::Remapper
Instance Method Details
#remap(ar_classes, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/reflections/remappers/has_and_belongs_to_many.rb', line 6 def remap(ar_classes, &block) ar_classes.each do |ar_class| associations_for_class(ar_class).each do |association| ar_class.includes(association.name).where("#{association.join_table}.#{association.foreign_key}").references(association.name).each do |record| update_record_or_yield record, association, &block end end end end |