module ActiveRecord::ForbiddenAttributesProtection

Private Class Methods

included(base) click to toggle source
# File lib/active_record/forbidden_attributes_protection.rb, line 18
def self.included(base)
  base.alias_method_chain :assign_attributes, :permitted
end

Private Instance Methods

assign_attributes_with_permitted(attributes) click to toggle source
# File lib/active_record/forbidden_attributes_protection.rb, line 10
def assign_attributes_with_permitted(attributes)
  if !attributes.respond_to?(:permitted?) || attributes.permitted?
    assign_attributes_without_permitted(attributes)
  else
    raise ActiveRecord::ForbiddenAttributes
  end
end