You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current documentation for Rails/StrongParametersExpect says that it's unsafe because the response code on invalid parameters changes from 500 to 400.
The current documentation for
Rails/StrongParametersExpect
says that it's unsafe because the response code on invalid parameters changes from 500 to 400.rubocop-rails/lib/rubocop/cop/rails/strong_parameters_expect.rb
Lines 8 to 12 in 1c4c37e
But it's also unsafe because
ActionController::Parameters#expect
is pickier about the format and may change some successful requests into failures.https://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-expect
This should be documented in the cop.
Example
The cop turned this code:
into this (after correction for #1417):
which now fails on these request parameters:
The problem seems to be the lack of double array brackets on the value for
comments_attributes
. Corrected code:(The extra array also works with
#require
/#permit
.)Rubocop version
The text was updated successfully, but these errors were encountered: