You get it because you use Lazy Loading. Before calling a specific object or objects, nothing is loaded.
In fact, your query will return an array of objects: ALL cars named TOYOTA. If you know that there is only one CAR with this name, you can do this:
theCar = Car.where(:name => 'TOYOTA').first # or theCar = Car.first(:name => 'TOYOTA') # or theCar = Car.find_by_name('TOYOTA')
And if there are many cars named TOYOTA:
theCars = Car.where( :name => "TOYOTA" ).all theCars.map(&:user_name) #=> ["Jhon", "Paul" ...]
source share