Skip to content

Instantly share code, notes, and snippets.

@wenbert
Created January 9, 2012 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wenbert/1582806 to your computer and use it in GitHub Desktop.
Save wenbert/1582806 to your computer and use it in GitHub Desktop.
1.9.2-p290 :005 > a = Allergy.all
Allergy Load (0.5ms) SELECT "allergies".* FROM "allergies"
=> [#<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>, #<Allergy id: 2, name: "Blah", desc: "Test", created_at: "2012-01-09 12:20:48", updated_at: "2012-01-09 12:20:48", patient_id: 2>]
1.9.2-p290 :006 > a[0]
=> #<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>
1.9.2-p290 :007 > a[0].full_name
NoMethodError: undefined method `full_name' for #<Allergy:0x1720870>
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing'
from (irb):7
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
1.9.2-p290 :008 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment