method

permit!

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Parameters
permit!() public

Sets the permitted attribute to true. This can be used to pass mass assignment. Returns self.

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">
Show source
Register or log in to add new notes.