Hi,
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?
ruby-1.9.2-p0 > u=User.scoped
User Load (0.3ms) SELECT “users”.* FROM “users”
[#<User id: 1, name: “u1”, created_at: “2010-09-08 04:08:28”,
updated_at:
“2010-09-08 04:08:28”>, #<User id: 2, name: “u2”, created_at:
“2010-09-08
04:08:34”, updated_at: “2010-09-08 04:08:34”>, #<User id: 3, name: “u3”,
created_at: “2010-09-08 04:08:39”, updated_at: “2010-09-08 04:08:39”>]
ruby-1.9.2-p0 > u.class
ActiveRecord::Relation < Object