diff options
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model.rb | 1 | ||||
-rw-r--r-- | activemodel/lib/active_model/attribute_assignment.rb | 11 | ||||
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 11 | ||||
-rw-r--r-- | activemodel/lib/active_model/secure_password.rb | 2 |
4 files changed, 13 insertions, 12 deletions
diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb index 58fe08cc11..8aa1b6f664 100644 --- a/activemodel/lib/active_model.rb +++ b/activemodel/lib/active_model.rb @@ -50,6 +50,7 @@ module ActiveModel eager_autoload do autoload :Errors autoload :StrictValidationFailed, 'active_model/errors' + autoload :UnknownAttributeError, 'active_model/errors' end module Serializers diff --git a/activemodel/lib/active_model/attribute_assignment.rb b/activemodel/lib/active_model/attribute_assignment.rb index 356421476c..087d11f708 100644 --- a/activemodel/lib/active_model/attribute_assignment.rb +++ b/activemodel/lib/active_model/attribute_assignment.rb @@ -48,16 +48,5 @@ module ActiveModel raise UnknownAttributeError.new(self, k) end end - - # Raised when unknown attributes are supplied via mass assignment. - class UnknownAttributeError < NoMethodError - attr_reader :record, :attribute - - def initialize(record, attribute) - @record = record - @attribute = attribute - super("unknown attribute '#{attribute}' for #{@record.class}.") - end - end end end diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 8326853879..f324788979 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -524,4 +524,15 @@ module ActiveModel # # => ActiveModel::StrictValidationFailed: Name can't be blank class StrictValidationFailed < StandardError end + + # Raised when unknown attributes are supplied via mass assignment. + class UnknownAttributeError < NoMethodError + attr_reader :record, :attribute + + def initialize(record, attribute) + @record = record + @attribute = attribute + super("unknown attribute '#{attribute}' for #{@record.class}.") + end + end end diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index 871031ece4..89da74efa8 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -26,7 +26,7 @@ module ActiveModel # it). When this attribute has a +nil+ value, the validation will not be # triggered. # - # For further customizability, it is possible to supress the default + # For further customizability, it is possible to suppress the default # validations by passing <tt>validations: false</tt> as an argument. # # Add bcrypt (~> 3.1.7) to Gemfile to use #has_secure_password: |