Search code examples
ruby-on-railsruby-on-rails-4strong-parameters

Cannot permit parameters?


This is bizarre to me, so I'm just curious if anyone else has run into this:

I've got the following:

def credential_params
  params.required(:credential).permit(:name,:agent_ids)
end

In my controller create and update actions I'm using mass assignment with the above parameter call...

@credential.update_attributes(credential_params)

But I still get Unpermitted parameters: agent_ids

If I change this to params.required(:credential).permit! (ie permit all) of course it works.

I feel like I must be overlooking some obvious gotcha here... anyone know what it might be?


Solution

  • try

    params.require(:credential).permit(:name, { :agent_ids => [] })