-
eileencodes authored
When a model has an STI enum type, the type wasn't properly applied when disable joins was set to true. In this case we need to apply the scope from the association in `add_constraints` so that `type` is included in the query. Otherwise in a `has_one :through` with `type` all records will be returned because we're not filtering on type. Long term I think this might be in the wrong place and that we want to do this in a new definition of `target_scope` but that's a future refactoring that needs to be done.
eileencodes authoredWhen a model has an STI enum type, the type wasn't properly applied when disable joins was set to true. In this case we need to apply the scope from the association in `add_constraints` so that `type` is included in the query. Otherwise in a `has_one :through` with `type` all records will be returned because we're not filtering on type. Long term I think this might be in the wrong place and that we want to do this in a new definition of `target_scope` but that's a future refactoring that needs to be done.
Loading