Is Rails3 ActiveRecord supposed to be lazy loading? In the following snippet when I call scoped on User model, it does return a ActiveRecord::Relation object. But at the same time the query is performed: "User Load (0.3ms) SELECT “users”.* FROM “users”. If I do a u.all after it, no query is performed. Any thoughts?
Is Rails3 ActiveRecord supposed to be lazy loading? In the following snippet
when I call scoped on User model, it does return a ActiveRecord::Relation
object. But at the same time the query is performed: "User Load (0.3ms)
SELECT "users".* FROM "users". If I do a u.all after it, no query is
performed. Any thoughts?
It's because you're doing this in the console: irb calls inspect on
the result of the expression in order to display it to you, which
triggers the load of the data.