module ActiveModel::ForbiddenAttributesProtection

def sanitize_for_mass_assignment(attributes)

def sanitize_for_mass_assignment(attributes)
  if attributes.respond_to?(:permitted?)
    raise ActiveModel::ForbiddenAttributesError if !attributes.permitted?
    attributes.to_h
  else
    attributes
  end
end