-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
Autocorrect for Rails/StrongParametersExpect
fails for accepts_nested_attributes_for
params
#1429
Comments
I also feel that using hashes in autocorrect is most of the time not necessary except for this case :
def product_params
params.expect(product: [ :name, data: {} ])
end |
chaadow
added a commit
to chaadow/rubocop-rails
that referenced
this issue
Jan 26, 2025
Fixes rubocop#1429 Use a recursive approach to autocorrect nested parameters - Top level hash keys do not get replaced by `[]` - Hash values that are hashes get replaced by `[]` - Arrays get replaced by double brackets `[[]]`
chaadow
added a commit
to chaadow/rubocop-rails
that referenced
this issue
Jan 26, 2025
Fixes rubocop#1429 Use a recursive approach to autocorrect nested parameters - Top level hash keys do not get replaced by `[]` - Hash values that are hashes get replaced by `[]` - Arrays get replaced by double brackets `[[]]`
9 tasks
chaadow
added a commit
to chaadow/rubocop-rails
that referenced
this issue
Jan 26, 2025
Fixes rubocop#1429 Use a recursive approach to autocorrect nested parameters - Top level hash keys do not get replaced by `[]` - Hash values that are hashes get replaced by `[]` - Arrays get replaced by double brackets `[[]]`
chaadow
added a commit
to chaadow/rubocop-rails
that referenced
this issue
Jan 26, 2025
Fixes rubocop#1429 Use a recursive approach to autocorrect nested parameters - Top level hash keys do not get replaced by `[]` - Hash values that are hashes get replaced by `[]` - Arrays get replaced by double brackets `[[]]`
chaadow
added a commit
to chaadow/rubocop-rails
that referenced
this issue
Jan 26, 2025
Fixes rubocop#1429 Use a recursive approach to autocorrect nested parameters - Top level hash keys do not get replaced by `[]` - Hash values that are hashes get replaced by `[]` - Arrays get replaced by double brackets `[[]]`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
I expect this :
to be autocorrected with :
Actual behavior
it gets autocorrected to this :
which is false, and make
row_prices
empty when provided with an arraySteps to reproduce the problem
To reproduce you can put the examples above in any controller and you will get the same result
Example can also be found here
RuboCop version
The text was updated successfully, but these errors were encountered: