moiristo / deep_cloneable

This gem gives every ActiveRecord::Base object the possibility to do a deep clone that includes user specified associations.
MIT License
786 stars 88 forks source link

Rails 4.2 Compatibility #45

Closed JamesChevalier closed 9 years ago

JamesChevalier commented 9 years ago

I'm using this method to deep_clone items:

def copy_to(new_date)
  self.deep_clone(include: [:photos, :variants]) do |original, copied_item|
    copied_item.deal_at = new_date if copied_item.respond_to?(:deal_at)
    copied_item.image   = original.image if copied_item.respond_to?(:image)
  end
end

Running rspec 3.1.0 against Rails 4.2.rc1 with deep_cloneable 2.0.0 fails on the deep_clone line with:

NoMethodError: undefined method `dup_has_many_has_many' for #<Deal:0x007f9b07dc7a18>
moiristo commented 9 years ago

This should be fixed with the latest code from master. Could you please verify that your tests pass when using the master branch?

chrisb commented 9 years ago

I was hitting this as well on 4.2.0.rc3 and can confirm it's working now via master branch.

Thank you!

moiristo commented 9 years ago

Thanks, this is now fixed in version 2.0.1.

moiristo commented 9 years ago

Ok 2.0.2 it is, as I forgot to fix the AR version dep in the gemspec :/