Skip to content

Instantly share code, notes, and snippets.

@wflanagan
Created January 15, 2012 14:17
Show Gist options
  • Save wflanagan/1615978 to your computer and use it in GitHub Desktop.
Save wflanagan/1615978 to your computer and use it in GitHub Desktop.
Example of error message
>> a = Entity.first
=> #<Entity _id: 4eaee481f575482978000005, created_at: 2011-10-31 18:10:09 UTC, updated_at: 2012-01-11 21:38:45 UTC, name: "http://paintballgunsforsale.blogspot.com/", twitter: nil, facebook: nil, wordsmaster_ids: [], keywords: ["cheap paintball guns for sale", "bridal jewelry", "flower wedding favors", "wedding hair accessories"], forums: [], directory_ids: [], references: [], mentions: [], profiles_retrieved: true, profile_url: "NOURL", company: nil, title: nil, host_names: nil, data: {}, demographics: {}, geographics: {}, description: "No description", ignore_project_ids: [], found_at_url: "http://paintballgunsforsale.blogspot.com/", new_profiles: [{"service"=>"blogger.com", "user_id"=>"02503684639969694595", "score"=>0.0}, {"service"=>"twitter", "user_id"=>nil, "score"=>1.0}], keyword_scores: nil, presence_score: nil, profiles: [{"_id"=>"4eaee481f575482978000004", "created_at"=>2011-11-05 19:43:59 UTC, "data"=>{}, "paintballgunsforsale#blogspot#com"=>"http://paintballgunsforsale.blogspot.com/", "score"=>0.0, "updated_at"=>2011-11-05 19:43:59 UTC}]>
>> a.scores["test"] = 1
NoMethodError: undefined method `get' for {}:Hash
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/field.rb:50:in `get'
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/attributes.rb:64:in `read_attribute'
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/fields.rb:55:in `block in create_accessors'
from (irb):2
from /Users/wflanagan/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
>> a = Entity.first
=> #<Entity _id: 4eaee481f575482978000005, created_at: 2011-10-31 18:10:09 UTC, updated_at: 2012-01-11 21:38:45 UTC, name: "http://paintballgunsforsale.blogspot.com/", twitter: nil, facebook: nil, wordsmaster_ids: [], keywords: ["cheap paintball guns for sale", "bridal jewelry", "flower wedding favors", "wedding hair accessories"], forums: [], directory_ids: [], references: [], mentions: [], profiles_retrieved: true, profile_url: "NOURL", company: nil, title: nil, host_names: nil, data: {}, demographics: {}, geographics: {}, description: "No description", ignore_project_ids: [], found_at_url: "http://paintballgunsforsale.blogspot.com/", new_profiles: [{"service"=>"blogger.com", "user_id"=>"02503684639969694595", "score"=>0.0}, {"service"=>"twitter", "user_id"=>nil, "score"=>1.0}], keyword_scores: nil, presence_score: nil, profiles: [{"_id"=>"4eaee481f575482978000004", "created_at"=>2011-11-05 19:43:59 UTC, "data"=>{}, "paintballgunsforsale#blogspot#com"=>"http://paintballgunsforsale.blogspot.com/", "score"=>0.0, "updated_at"=>2011-11-05 19:43:59 UTC}]>
>> a.fix_scores
NoMethodError: undefined method `get' for {}:Hash
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/field.rb:50:in `get'
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/attributes.rb:64:in `read_attribute'
from /Users/wflanagan/sites/marketfu/vendor/bundle/bundler/gems/mongoid-7b3cfd92c5ab/lib/mongoid/fields.rb:55:in `block in create_accessors'
from /Users/wflanagan/sites/marketfu/app/models/entity.rb:432:in `fix_scores'
from (irb):5
from /Users/wflanagan/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment