Sha256: ea6b66cac6ddef99a96df93a6e779a4332e56689fb8480b51d87a1ca5082af74
Contents?: true
Size: 807 Bytes
Versions: 94
Compression:
Stored size: 807 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 alias :sanitize_forbidden_attributes :sanitize_for_mass_assignment end end
Version data entries
94 entries across 89 versions & 9 rubygems