Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
fix truncation in ActiveRecord::Calculations #13308
This PR fixes a wrong conversion to column_type in
This prevent truncation of result and allows the user
This PR will change the current behavior because we no longer parse the fields from the expression. Perhaps we need to deprecate the current behavior first before moving to this solution. Problem is that we can't suggest a "new" way of doing things. This means we would also need a flag to disable the deprecated behavior and the warning. Basically a feature flag for this PR.
@rafaelfranca what do you think?
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
dbeee30 looks good with Oracle adapter.
$ ARCONN=oracle ruby -Itest test/cases/calculations_test.rb -n test_complex_expression_not_lose_data_when_returns_different_type_than_column_type Using oracle Run options: -n test_complex_expression_not_lose_data_when_returns_different_type_than_column_type --seed 24805 # Running: . Finished in 0.852083s, 1.1736 runs/s, 10.5623 assertions/s. 1 runs, 9 assertions, 0 failures, 0 errors, 0 skips 2.0.0-p353@railsmaster [ prevent_conversion_to_int ~/git/rails/activerecord]$
You can use https://github.com/yahonda/rails-dev-box-runs-oracle for ActiveRecord testing with Oracle database. Please give it a try.
Good! Thanks for all