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???
On 3 Apr 2008, at 14:57, Selvaraj S. wrote:
Hai…
Whether ruby on rails is eager loading or lazy loading???
I think while using association in model its getting eager loading…
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 C. wrote:
On 3 Apr 2008, at 14:57, Selvaraj S. wrote:
Hai…
Whether ruby on rails is eager loading or lazy loading???
I think while using association in model its getting eager loading…
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
Frederick C. 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!
A :lazy => true directive would have fixed it…
–
Phlip
On 22 Apr 2008, at 14:01, Phlip wrote:
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs