-
-
Notifications
You must be signed in to change notification settings - Fork 827
Closed
Description
Large number in params can raise ActiveModel::RangeError. This issue was already discussed here: #1064
I wrote a test to reproduce this error:
require "test_helper"
class UserTest < ActiveSupport::TestCase
test "ActiveModel::RangeError" do
user = users(:one)
assert_equal [user], User.where(age: 10) # pass
assert_equal [user], User.ransack(age_eq: 10).result # pass
assert_equal [], User.where(age: 123456789012345678901) # pass
assert_equal [], User.ransack(age_eq: 123456789012345678901).result
#=> ActiveModel::RangeError: 123456789012345678901 is out of range for ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer with limit 8 bytes
end
endHowever, I hope Ransack could return [] like ActiveRecord.
My code is here so you can run it: https://github.com/JunichiIto/ransack-range-error-sandbox/blob/main/test/models/user_test.rb
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels