dupe
dupe copied to clipboard
lazy attributes getting duped return values
in version 0.4.8, if i have a definition that has a lazy attribute that returns a Dupe record, that record is actually a duped version of the original record created - meaning that i can change the value of that record without actually affecting the original record in memory (the only people will find through a Dupe.find).
e.g.:
Dupe.define :book do |book| book.genre do Dupe.find_or_create :genre, :name => 'Sci-fi' end end b = Dupe.create :book b2 = Dupe.create :book b.genre.name = 'Science Fiction' puts b2.genre.name # should return 'Science Fiction', but instead still returns 'Sci-fi'