Sha256: a995fb63830dc38bf07da8e3668ba22ac07567bb80df2d532c6c3c8fddca82e7
Contents?: true
Size: 734 Bytes
Versions: 33
Compression:
Stored size: 734 Bytes
Contents
module ActiveModel # Raised when forbidden attributes are used for mass assignment. # # class Person < ActiveRecord::Base # end # # params = ActionController::Parameters.new(name: 'Bob') # Person.new(params) # # => ActiveModel::ForbiddenAttributesError # # params.permit! # Person.new(params) # # => #<Person id: nil, name: "Bob"> class ForbiddenAttributesError < StandardError end module ForbiddenAttributesProtection # :nodoc: protected def sanitize_for_mass_assignment(attributes) if attributes.respond_to?(:permitted?) && !attributes.permitted? raise ActiveModel::ForbiddenAttributesError else attributes end end end end
Version data entries
33 entries across 33 versions & 2 rubygems