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 got 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 it looks strange.
But in rspec i have received nil value for metric_ids in any case :( I have not found any information about the problem. Maybe someone here may help me.
Thanks in advance.