8
When I'm in the 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, it's able to locate the single
record and store it in my variable p, but I can't print the last_name
column. For example:
p = Person.where(id: 34).limit(1)
printing p here shows all the columns but p.last_name says this
NoMethodError: undefined method `last_name' for
#<ActiveRecord::Relation:0x000000055f8840>
any help would be appreciated.