3
중첩 된 다형성 연결을 열심히로드하려고합니다. 솔루션을 찾을 수없는 것 같습니다. 수중첩 된 다형성 연결을 열망하는 방법
ActiveRecord::EagerLoadPolymorphicError - Can not eagerly load the polymorphic association :ownable
방법 :
Post.includes(comments: :ownable).to_a
을하지만이 오류를 던지고 :
class Post
has_many :comments
end
class Comment
belongs_to :ownable, polymorphic: true
end
class User
has_many :comments, as: :ownable
end
그리고 여기에 내가 할 노력하고있어입니다 : 여기
내 모델 설정입니다 이 중첩 된 다형성 연관을 열망합니까? 모든 포스트 has_many 코멘트
의 중복 가능성 [열망로드 다형성 (http://stackoverflow.com/questions/16123492/eager-load-polymorphic) – Makoto