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 Children < ActiveRecord::Base
belongs_to :parent
has_one :a_ancestor, through: :parent
has_one :b_ancestor, through: :parent
has_one :c_ancestor, through: :parent
end
class Parent < ActiveRecord::Base
belongs_to :a_ancestor
belongs_to :b_ancestor
belongs_to :c_ancestor
end
class AAncestor < ActiveRecord::Base; end
class BAncestor < ActiveRecord::Base; end
class CAncestor < ActiveRecord::Base; end
Children.ransack(
a_ancestor_id_eq: 1,
b_ancestor_id_eq: 1,
c_ancestor_id_eq: 1,
).result.to_sql
# => LEFT OUTER JOINs `parents` 3 times