dupe icon indicating copy to clipboard operation
dupe copied to clipboard

lazy attributes getting duped return values

Open moonmaster9000 opened this issue 15 years ago • 0 comments

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'

moonmaster9000 avatar Feb 12 '10 14:02 moonmaster9000