New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
between broken with decimal columns #411
Comments
I have filed a bug report because it might make sense for Numeric to provide #infinite? https://bugs.ruby-lang.org/issues/12039 Not sure what the best outcome is here, but I don't think this should fail. |
Currently, the rough plan is to remove the infinite handling from Arel, and move it into Active Record as a result of rails/rails@6efb394. Your proposed fix in Ruby would solve this, and is probably the best place to handle it. |
Thanks for the quick reply. What is the reasoning behind moving it to the ActiveRecord code base? |
Arel is an AST, not a query builder. We need information that only exists at the AR level for this to be useful. |
@sgrif Just thought I'd let you know, that this is now fixed in Ruby. |
Thank you for following up. |
@sgrif Thanks so much for all your hard work dude, you're awesome! |
If you try to supply a range made from
BigDecimal
values (e.g. provided by columns of type decimal), the code breaks.arel/lib/arel/predications.rb
Lines 27 to 45 in 63ea665
It's because you can't compare BigDecimal with INFINITY
The solution is not to use comparison but to use Float#infinite? and BigDecimal#infinite?
The problem this introduces is that it no longer works for Numeric values, e.g.
Fixnum
andBignum
. However, these can never be infinite.The text was updated successfully, but these errors were encountered: