new(attributes = nil)
Class Public methods
Returns a new instance of ActionController::Parameters
. Also,
sets the permitted
attribute to the default value of
ActionController::Parameters.permit_all_parameters
.
1 2 3 4 5 6 7 8 9 10 11 12 | class Person < ActiveRecord::Base end params = ActionController::Parameters. new (name: 'Francesco' ) params.permitted? # => false Person. new (params) # => ActiveModel::ForbiddenAttributesError ActionController::Parameters.permit_all_parameters = true params = ActionController::Parameters. new (name: 'Francesco' ) params.permitted? # => true Person. new (params) # => #<Person id: nil, name: "Francesco"> |
Please login to continue.