Skip to content

Instantly share code, notes, and snippets.

@cameroncox
Created July 30, 2008 21:42
Show Gist options
  • Save cameroncox/3341 to your computer and use it in GitHub Desktop.
Save cameroncox/3341 to your computer and use it in GitHub Desktop.
class JournalEntry
include DataMapper::Resource
property :id, Serial
property :summary, Text, :lazy => true
belongs_to :user
end
## works fine
>> JouralEntry.first.summary
=> "Test"
## bombs with stack track
>> user = User.first
>> user.journal_entries.first.summary
TypeError: can't modify frozen array
from /Library/Ruby/Gems/1.8/gems/extlib-0.9.4/lib/extlib/lazy_array.rb:32:in `replace'
from /Library/Ruby/Gems/1.8/gems/extlib-0.9.4/lib/extlib/lazy_array.rb:32:in `replace'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/collection.rb:273:in `replace'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/collection.rb:39:in `reload'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/resource.rb:445:in `reload_attributes'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/resource.rb:591:in `lazy_load'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/property.rb:435:in `send'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/property.rb:435:in `lazy_load'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/property.rb:377:in `get'
from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.4/lib/dm-core/resource.rb:102:in `attribute_get'
from /Users/cameron/Projects/2008/do.it/app/models/journal_entry.rb:44:in `summary'
from (irb):8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment