You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Person
has_many :out, :knows, model_class: 'Person', type: nil
has_many :in, :posts, type: :posts
end
class Post
has_one :out, :owner, origin: :posts, model_class: 'Person'
end
Currently we only allow fixed length or infinite length paths in eager load like Person.where(id: [1,5,6]).with_association('knows*') or Person.where(id: [1,5,6]).with_association('knows*4'). If we want to eager load post on persons and the persons that they know, we have to do Person.where(id: [1,5,6]).with_association(['posts', 'knows*.posts']). This results in tow optional matches for person's posts and persons's know's posts. To avoid this we can have Person.where(id: [1,5,6]).with_association('knows*0...posts'), which will result in only one optional match for posts, hence shorter and faster query.
The text was updated successfully, but these errors were encountered:
Given,
Currently we only allow fixed length or infinite length paths in eager load like
Person.where(id: [1,5,6]).with_association('knows*')
orPerson.where(id: [1,5,6]).with_association('knows*4')
. If we want to eager load post on persons and the persons that they know, we have to doPerson.where(id: [1,5,6]).with_association(['posts', 'knows*.posts'])
. This results in tow optional matches for person's posts and persons's know's posts. To avoid this we can havePerson.where(id: [1,5,6]).with_association('knows*0...posts')
, which will result in only one optional match for posts, hence shorter and faster query.The text was updated successfully, but these errors were encountered: