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

Set raw attributes from column defaults #56

Closed AskarZinurov closed 8 years ago

AskarZinurov commented 8 years ago

Sometimes it is useful to set default serialized attributes in db level. Rails caches this nicely, but deep clone fails. This is bugfix.

moiristo commented 8 years ago

Hi,

A small problem caused by this commit is that exceptions are marked as dirty, see #62. The strange thing is that the test you've added passes in Travis when I use the index operator (ActiveRecord#[]=) when setting the column default (which should be the same as using write_attribute according to the doc :s)..

See: https://github.com/moiristo/deep_cloneable/tree/dirty-attributes-fix https://travis-ci.org/moiristo/deep_cloneable/builds/138013230

I'm planning to merge this into master, but there might be something that I'm missing.. could you have a look?