Hai..
Whether ruby on rails is eager loading or lazy loading???
I think while using association in model its getting eager loading..
can any one explain more???
Hai..
Whether ruby on rails is eager loading or lazy loading???
I think while using association in model its getting eager loading..
can any one explain more???
Assuming I do bob = Person.find(124) and then do something with bob.orders, then the association is lazy loaded, it's not loaded until you touch it. You can also eager load: bob = Person.find(124, :include => 'orders')
Fred
Thanks...I got it...
Frederick Cheung wrote:
Frederick Cheung wrote:
Assuming I do bob = Person.find(124) and then do something with bob.orders, then the association is lazy loaded, it's not loaded until you touch it. You can also eager load: bob = Person.find(124, :include => 'orders')
How do you use :include to add a column that must appear in the :conditions, _without_ eagerloading everything in that column's table?
When we were tuning and we hit that one, we had to drop :include back to an old-fashioned :joins, which is really irritating!
Frederick Cheung wrote:
Assuming I do bob = Person.find(124) and then do something with bob.orders, then the association is lazy loaded, it's not loaded
until you touch it. You can also eager load: bob =
Person.find(124, :include => 'orders')How do you use :include to add a column that must appear in
the :conditions, _without_ eagerloading everything in that column's table?When we were tuning and we hit that one, we had to drop :include
back to an old-fashioned :joins, which is really irritating!
You can do that with joins these days (:joins => :orders)
Fred