-
-
Couldn't load subscription status.
- Fork 829
Milestone
Description
Is this expected?
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
Here's executable test of the issue
https://gist.github.com/Liooo/ea4629204f7f3233633125e5f134b574
Copilot