Folks
  When im in rails 3.2 console i can do this just fine

  p = Person.last
  p.last_name

  and it prints the last name.

  But when i try to find it by the id, its able to locate the single
record and store it in my variable p, but i cant print the last_name
column. For example.


   p = Person.where(id: 34).limit(1)

   "printing p here shows all the columns"

   p.last_name says this

NoMethodError: undefined method `last_name' for
#<ActiveRecord::Relation:0x000000055f8840>

any help would be appreciated, thanks.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to