ActiveRecord `or` broken
Closed this issue · 2 comments
fdutey commented
Adding this gem breaks ActiveRelation or
method. Scopes are evaluated too early
Example
table = Model.arel_table
col_a = table[:col_a]
col_b = table[:col_b]
Model.where(
col_a.eq(1)
).or(
Model.where(
col_b.eq(1)
)
)
Before: the request is triggered after the or (so SQL is col_a = 1 OR col_b = 1
)
Now: the request is triggered before the or (so SQL is col_a = 1
)
jdelporte commented
Hi Florian,
Thanks for your contribution.
The gem 2.0.22 should fix this issue.
fdutey commented
Works like a charm.
Thank you so much! ;)