lib/copyable/declarations/associations.rb in copyable-0.0.2 vs lib/copyable/declarations/associations.rb in copyable-0.1.0
- old
+ new
@@ -4,15 +4,15 @@
class << self
# this is the algorithm for copying associated records according to the
# instructions given in the copyable declaration
- def execute(association_list, original_model, new_model, skip_validations)
+ def execute(association_list, original_model, new_model, skip_validations, skip_associations)
@skip_validations = skip_validations
association_list.each do |assoc_name, advice|
association = original_model.class.reflections[assoc_name.to_sym]
check_advice(association, advice, original_model)
- unless advice == :do_not_copy
+ unless advice == :do_not_copy || skip_associations.include?(assoc_name.to_sym)
copy_association(association, original_model, new_model)
end
end
end