Skip to content

Instantly share code, notes, and snippets.

@dbkbali
Created October 12, 2011 09:28
Show Gist options
  • Save dbkbali/1280740 to your computer and use it in GitHub Desktop.
Save dbkbali/1280740 to your computer and use it in GitHub Desktop.
Console Output mongoid globalize frozen-hash
ruby-1.9.2-p290-patched :001 > act = Activity.create(:name => "exercise")
=> #<Activity _id: 4e9559899a4b7c3b7c000002, _type: nil, category_ids: [], slug: "exercise", name: "exercise">
ruby-1.9.2-p290-patched :002 > act.translations
=> [#<Activity::Translation _id: 4e9559899a4b7c3b7c000001, _type: "Activity::Translation", locale: "en", name: "exercise">]
ruby-1.9.2-p290-patched :003 > act.reload
=> #<Activity _id: 4e9559899a4b7c3b7c000002, _type: nil, category_ids: [], slug: "exercise", name: "exercise">
ruby-1.9.2-p290-patched :004 > act.delete
RuntimeError: can't modify frozen hash
from /Users/dbk/Development/mongoid_globalize/lib/mongoid_globalize/instance_methods.rb:18:in `merge!'
from /Users/dbk/Development/mongoid_globalize/lib/mongoid_globalize/instance_methods.rb:18:in `attributes'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/attributes.rb:46:in `read_attribute'
from /Users/dbk/Development/mongoid_globalize/lib/mongoid_globalize/instance_methods.rb:64:in `read_attribute'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/fields.rb:300:in `block (2 levels) in create_accessors'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/identity_map.rb:34:in `remove'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/identity_map.rb:116:in `remove'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/persistence/deletion.rb:26:in `prepare'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/persistence/operations/remove.rb:26:in `persist'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/mongoid-2.3.1/lib/mongoid/persistence.rb:56:in `remove'
from (irb):4
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /Users/dbk/.rvm/gems/ruby-1.9.2-p290-patched@rails31/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ruby-1.9.2-p290-patched :005 > quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment