aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-05 05:40:37 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-05 05:40:37 -0700
commit9545c6bcee84d4141ee459b41068708a6d7b7066 (patch)
tree3a4f5b8b4132805b4ac9cf0834a1031d70cfc3ec
parent45357c5b1476def0d89c3a8213bc8a0cea61554c (diff)
parent23ef1dfd70886d0024e2fe6b60c3a5d3efa8d90c (diff)
downloadrails-9545c6bcee84d4141ee459b41068708a6d7b7066.tar.gz
rails-9545c6bcee84d4141ee459b41068708a6d7b7066.tar.bz2
rails-9545c6bcee84d4141ee459b41068708a6d7b7066.zip
Merge pull request #11757 from ryog/fix_document_active_model_errors
Fix: documentation for ActiveModel::Errors [ci skip]
-rw-r--r--activemodel/lib/active_model/errors.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index e608a649f8..cf7551e4f4 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -238,8 +238,8 @@ module ActiveModel
# object. You can pass the <tt>:full_messages</tt> option. This determines
# if the json object should contain full messages or not (false by default).
#
- # person.as_json # => {:name=>["can not be nil"]}
- # person.as_json(full_messages: true) # => {:name=>["name can not be nil"]}
+ # person.errors.as_json # => {:name=>["can not be nil"]}
+ # person.errors.as_json(full_messages: true) # => {:name=>["name can not be nil"]}
def as_json(options=nil)
to_hash(options && options[:full_messages])
end
@@ -247,8 +247,8 @@ module ActiveModel
# Returns a Hash of attributes with their error messages. If +full_messages+
# is +true+, it will contain full messages (see +full_message+).
#
- # person.to_hash # => {:name=>["can not be nil"]}
- # person.to_hash(true) # => {:name=>["name can not be nil"]}
+ # person.errors.to_hash # => {:name=>["can not be nil"]}
+ # person.errors.to_hash(true) # => {:name=>["name can not be nil"]}
def to_hash(full_messages = false)
if full_messages
messages = {}