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
{{ message }}
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.
Faced a strange problem or bug. I have a route with strong parameters method:
def st_params
params.permit([:id, logs: [], metric_ids: []])
end
Then i call it with, for example, rspec:
post some_path(format:json, metric_ids:[ [1,0,1], [5,1,4] ])
And when i call a st_params method there is no metric_ids param and i have received message in logs: Unpermitted parameters: metric_ids, but if i change st_params method like this:
def st_params
p = params.permit([:id, logs: [], metric_ids: []])
p[:metric_ids] = params[:metric_ids]
# or just p = params.permit!
p
end
Now, everything works fine in browser, but in rspec i have received nil value for metric_ids in any case :( I have not found any information about the problem in documentation. Maybe someone here will help me.
The text was updated successfully, but these errors were encountered:
What version of Rails are you using? If you're using Rails 4 of later, you should submit your issues against rails/rails. This is a compatibility gem for Rails versions prior to 4.
Further, sending an array of array of integers is not something that is generally accommodated by Rails, which generally would represent such data using a hash.
Faced a strange problem or bug. I have a route with strong parameters method:
Then i call it with, for example, rspec:
And when i call a st_params method there is no metric_ids param and i have received message in logs: Unpermitted parameters: metric_ids, but if i change st_params method like this:
Now, everything works fine in browser, but in rspec i have received nil value for metric_ids in any case :( I have not found any information about the problem in documentation. Maybe someone here will help me.
The text was updated successfully, but these errors were encountered: