-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix formatting ActionController::Parameters #29
Conversation
Add an extra check for unpermitted Rails paramters that will report they they respond to :to_hash but raise an error. Fixes #17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HarlemSquirrel almost ready to merge. Just wondering about that regexp 😅
spec/ext/active_record_spec.rb
Outdated
@@ -259,7 +259,7 @@ class SubUser < User { | |||
expect(out).to match( | |||
/\s*first\(\*args,\s+&block\)\s+#<Class:ActiveRecord::Base> \(ActiveRecord::Querying\)/ | |||
) | |||
elsif RUBY_VERSION >= '2.4.4' | |||
elsif RUBY_VERSION =~ /2\.[4-6]\.([4-9]|[1-9][0-9])/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly that regexp? Why not =~ /2\.[4-6]\.\d+/
or simply >= '2.4.0'
since the branch for 2.7 is above? Or >= '2.4.0' && < '2.7.0'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we need to find version greater than or equal to 2.4.4 and now that 2.4.10 is out, the string comparison fails with that version.
'2.4.3' >= '2.4.4'
# => false
'2.4.4' >= '2.4.4'
# => true
'2.4.10' >= '2.4.4'
# => false
'2.4.3' =~ /2\.[4-6]\.([4-9]|[1-9][0-9])/
# => nil
'2.4.4' =~ /2\.[4-6]\.([4-9]|[1-9][0-9])/
# => 0
'2.4.10' =~ /2\.[4-6]\.([4-9]|[1-9][0-9])/
# => 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. But the restrictions then also apply to Ruby 2.5 and 2.6.
How about: /^2\.4\.([4-9]|[1-9][0-9])|^2\.[56]\./
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
OK, I had to run |
Add an extra check for unpermitted Rails paramters
that will report they they respond to :to_hash
but raise an error.
Fixes #17