aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2016-05-14 09:54:23 +0000
committerVijay Dev <vijaydev.cse@gmail.com>2016-05-14 09:54:23 +0000
commit83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1 (patch)
tree899a536f2c978f6349a48932a2da1c0cc8b84c4a /activemodel
parent4046ac7e88dfcd9089e602ad0d6196bc8efc46a6 (diff)
parent26e59e686c2553035ad3f7c50089b79c93d07f38 (diff)
downloadrails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.tar.gz
rails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.tar.bz2
rails-83ecf3fe56f0c4b89cc5f2c5bdab6e0e7d26b7a1.zip
Merge branch 'master' of github.com:rails/docrails
Conflicts: guides/source/configuring.md
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/errors.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 685e235730..696e6d31da 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -310,9 +310,9 @@ module ActiveModel
# <tt>:strict</tt> option can also be set to any other exception.
#
# person.errors.add(:name, :invalid, strict: true)
- # # => ActiveModel::StrictValidationFailed: name is invalid
+ # # => ActiveModel::StrictValidationFailed: Name is invalid
# person.errors.add(:name, :invalid, strict: NameIsInvalid)
- # # => NameIsInvalid: name is invalid
+ # # => NameIsInvalid: Name is invalid
#
# person.errors.messages # => {}
#
@@ -531,6 +531,15 @@ module ActiveModel
end
# Raised when unknown attributes are supplied via mass assignment.
+ #
+ # class Person
+ # include ActiveModel::AttributeAssignment
+ # include ActiveModel::Validations
+ # end
+ #
+ # person = Person.new
+ # person.assign_attributes(name: 'Gorby')
+ # # => ActiveModel::UnknownAttributeError: unknown attribute 'name' for Person.
class UnknownAttributeError < NoMethodError
attr_reader :record, :attribute