Params permit!

A method1 that sets the permitted attribute to true.

  • Used to pass mass assignment.
  • Needs to be used with caution.
class Person < ActiveRecord::Base
end
params = ActionController::Parameters.new(name: "Francesco")
params.permitted?  # => false
Person.new(params) # => ActiveModel::ForbiddenAttributesError
params.permit!
params.permitted?  # => true
Person.new(params) # => #<Person id: nil, name: "Francesco">