moiristo / deep_cloneable

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

dirty attributes issue in 2.2.1 but not in 2.2.0 #62

Closed pa657 closed 8 years ago

pa657 commented 8 years ago

Hello, Thank you for this gem :) A little issue in version 2.2.1 of this gem. With this code :

a = Product.create(title: 'demo')
b = a.deep_clone(except: [:title])
puts b.title.inspect #=> nil
puts b.title_was.inspect #=> nil
#with 2.2.0
puts b.title_changed?.to_s => false
#with 2.2.1
puts b.title_changed?.to_s => true

Context : Ruby 2.3.1 Rails 4.2.6

moiristo commented 8 years ago

Not sure yet how to handle this, I think it is caused by https://github.com/moiristo/deep_cloneable/commit/d0e6f3221465a57fd05b5ad1bc61acf3971aea83 .. will look into it.

moiristo commented 8 years ago

Thanks for your feedback, I've fixed this in aef5db87b51bf5bdfd911eea95bd4b27e36dce3c.