Ich habe 4 Modelle:Eager Laden in verschachtelte Vereinigung
class Profile < ActiveRecord::Base
has_many :profile_profile_categories, dependent: :destroy
has_many :profile_categories, through: :profile_profile_categories
end
class ProfileCategory < ActiveRecord::Base
belongs_to :profile_subject
end
class ProfileSubject < ActiveRecord::Base
has_many :profile_categories, dependent: :destroy
end
class ProfileProfileCategory < ActiveRecord::Base
belongs_to :profile_category
belongs_to :profile
end
Wie kann ich laden Profil und eifrig Last ProfileCategory und ProfileSubject?
Profile.includes(profile_categories: :profile_subject)
funktioniert nicht.
Gem Kugel nächste Meldung im Browser:
ProfileCategory Load (2.6ms) SELECT "profile_categories".* FROM "profile_categories" WHERE "profile_categories"."profile_subject_id" = $1 [["profile_subject_id", 4]]
Dank
es nicht funktioniert. – verrom
Try This once ... – Mukesh
Das funktioniert nicht auch. – verrom