Lazy loading in Rails 3.2.6

Viewed 4472

I have found in several resources online than when doing stuff like:

cars = Car.where(:colour => 'black')

The query is not executed, until you do something like:

cars.each {|c| puts c.name } 

However, in my Rails 3.2.6 project, when I do the following in the console:

User.where(:first_name => "John")

I get the following:

 User Load (1.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`first_name` = 'John'

So, the query is being executed right?

Where did the lazy loading go? Or am I missing something here?

3 Answers
Related