Hi,
I am having trouble with eager loading in my app. It used to work all the
time, but since upgrading to rails 2.0.2, and now rails 2.1, it doesn''t
work
with many of my queries. For example, this find is loaded eagerly:
@release = Release.find_by_url(params[:id],
:include => [{:artist => :artist_images}, {:songs => :track},
:collection, :hard_products, :release_images, :label],
:conditions => ["labels.name=? OR labels.name=? OR
labels.name=?",
"Alien8 Recordings", "Fancy", "Substractif"])
but this find is not (and it is a simpler query):
@release = Release.find_by_url(params[:id],
:include => [{:songs => :track}, :collection, :hard_products])
FYI, here''s my model relationships:
class Release < ActiveRecord::Base
belongs_to :artist
belongs_to :label
has_many :release_images, :dependent => :destroy
has_many :hard_products
has_many :songs
has_one :collection
end
class Song < Product
belongs_to :release
has_one :track, :dependent => :destroy
end
class Track < ActiveRecord::Base
belongs_to :song
belongs_to :collection
end
class Collection < Product
has_many :tracks
belongs_to :release
end
Does anyone know how to force rails to load eagerly?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---