diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-20 18:31:22 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-20 18:31:40 -0700 |
commit | 685a53a360d0d8fc4a9f3b49f900621c940a71f2 (patch) | |
tree | fa6b38f75a873a21c3e380f1acbab3d019293363 /activeresource/lib/active_resource/validations.rb | |
parent | db05c73fb6e2294c576ef9889c70940891682c32 (diff) | |
parent | 164a94d0bc8c9124ab820506e5ad79496395c026 (diff) | |
download | rails-685a53a360d0d8fc4a9f3b49f900621c940a71f2.tar.gz rails-685a53a360d0d8fc4a9f3b49f900621c940a71f2.tar.bz2 rails-685a53a360d0d8fc4a9f3b49f900621c940a71f2.zip |
Merge branch 'master' into cherry
Conflicts:
activesupport/CHANGELOG
activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
activesupport/lib/active_support/core_ext/hash/conversions.rb
activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
activesupport/lib/active_support/core_ext/string/multibyte.rb
activesupport/lib/active_support/core_ext/time/calculations.rb
activesupport/lib/active_support/deprecation.rb
Diffstat (limited to 'activeresource/lib/active_resource/validations.rb')
-rw-r--r-- | activeresource/lib/active_resource/validations.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb index de3339935f..8d21f8adbb 100644 --- a/activeresource/lib/active_resource/validations.rb +++ b/activeresource/lib/active_resource/validations.rb @@ -3,7 +3,7 @@ module ActiveResource end # Active Resource validation is reported to and from this object, which is used by Base#save - # to determine whether the object in a valid state to be saved. See usage example in Validations. + # to determine whether the object is in a valid state to be saved. See usage example in Validations. class Errors include Enumerable attr_reader :errors @@ -14,7 +14,10 @@ module ActiveResource @base, @errors = base, {} end - # Add an error to the base Active Resource object rather than an attribute. + # Adds an error to the base object instead of any particular attribute. This is used + # to report errors that don't tie to any specific attribute, but rather to the object + # as a whole. These error messages don't get prepended with any field name when iterating + # with +each_full+, so they should be complete sentences. # # ==== Examples # my_folder = Folder.find(1) @@ -68,9 +71,9 @@ module ActiveResource !@errors[attribute.to_s].nil? end - # A method to return the errors associated with +attribute+, which returns nil, if no errors are - # associated with the specified +attribute+, the error message if one error is associated with the specified +attribute+, - # or an array of error messages if more than one error is associated with the specified +attribute+. + # Returns +nil+ if no errors are associated with the specified +attribute+. + # Returns the error message if one error is associated with the specified +attribute+. + # Returns an array of error messages if more than one error is associated with the specified +attribute+. # # ==== Examples # my_person = Person.new(params[:person]) @@ -92,9 +95,7 @@ module ActiveResource alias :[] :on - # A method to return errors assigned to +base+ object through add_to_base, which returns nil, if no errors are - # associated with the specified +attribute+, the error message if one error is associated with the specified +attribute+, - # or an array of error messages if more than one error is associated with the specified +attribute+. + # Returns errors assigned to the base object through +add_to_base+ according to the normal rules of <tt>on(attribute)</tt>. # # ==== Examples # my_account = Account.find(1) |