There’s no reason to use ‘where’ when you want to select by id since most of the times id is an unique value, and there’s no reason to use ‘limit(1)’ if every time you select by id (SELECT * FROM users where id=34) it returns only one row, so you can use:
p = People.find_by_id 34 # this will return nil if id doesn’t exits
p = People.find 34 # this will raise an exception if the id doesn’t exists
and then use the object like this:
Otherwise, as Fernando pointed out, you’ll get a collection (a kind of Array) whose type is ActiveRecord::Relation.
If you’re using the console you should realize that when you type "p = Person.where(id: 34).limit(1) " it returns something like:
[#<Person id: 34, last_name: “the_last_name”…>]
So you should treat it as an Array (actually as an Enumerable) that responds to :first, :last, :each, etc