Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Document AttributeAssignmentError and MultiparameterAssignmentErrors.

  • Loading branch information...
commit ae6b46f00b5b8b2939c6b37ce3329c83de7e71db 1 parent aca44bc
@chuyeow chuyeow authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 activerecord/lib/active_record/base.rb
View
15 activerecord/lib/active_record/base.rb
@@ -92,13 +92,15 @@ class Rollback < ActiveRecordError
class DangerousAttributeError < ActiveRecordError
end
- # Raised when you've tried to access a column which wasn't
- # loaded by your finder. Typically this is because <tt>:select</tt>
- # has been specified.
+ # Raised when you've tried to access a column which wasn't loaded by your finder.
+ # Typically this is because <tt>:select</tt> has been specified.
class MissingAttributeError < NoMethodError
end
- class AttributeAssignmentError < ActiveRecordError #:nodoc:
+ # Raised when an error occured while doing a mass assignment to an attribute through the
+ # +attributes=+ method. The exception has an +attribute+ property that is the name of the
+ # offending attribute.
+ class AttributeAssignmentError < ActiveRecordError
attr_reader :exception, :attribute
def initialize(message, exception, attribute)
@exception = exception
@@ -107,7 +109,10 @@ def initialize(message, exception, attribute)
end
end
- class MultiparameterAssignmentErrors < ActiveRecordError #:nodoc:
+ # Raised when there are multiple errors while doing a mass assignment through the +attributes+
+ # method. The exception has an +errors+ property that contains an array of +AttributeAssignmentError+
+ # objects, each corresponding to the error while assigning to an attribute.
+ class MultiparameterAssignmentErrors < ActiveRecordError
attr_reader :errors
def initialize(errors)
@errors = errors
Please sign in to comment.
Something went wrong with that request. Please try again.