aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRyoji Yoshioka <yoshioka.ryoji@gmail.com>2013-08-05 18:54:51 +0900
committerRyoji Yoshioka <yoshioka.ryoji@gmail.com>2013-08-05 18:58:22 +0900
commit23ef1dfd70886d0024e2fe6b60c3a5d3efa8d90c (patch)
tree3a4f5b8b4132805b4ac9cf0834a1031d70cfc3ec /activemodel
parent45357c5b1476def0d89c3a8213bc8a0cea61554c (diff)
downloadrails-23ef1dfd70886d0024e2fe6b60c3a5d3efa8d90c.tar.gz
rails-23ef1dfd70886d0024e2fe6b60c3a5d3efa8d90c.tar.bz2
rails-23ef1dfd70886d0024e2fe6b60c3a5d3efa8d90c.zip
Fix: documentation for ActiveModel::Errors
Diffstat (limited to 'activemodel')
-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 = {}