diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-06-22 12:42:32 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-06-22 12:42:32 -0500 |
commit | 629bc03bf885f8d1450a28972c5bea630a079e85 (patch) | |
tree | 3d9a4535629711a0041c010e05ac063e89f7e23d /guides/assets | |
parent | 35ee8fa3d8b3ad49179f86af2bec2e53af335ac9 (diff) | |
download | rails-629bc03bf885f8d1450a28972c5bea630a079e85.tar.gz rails-629bc03bf885f8d1450a28972c5bea630a079e85.tar.bz2 rails-629bc03bf885f8d1450a28972c5bea630a079e85.zip |
change param name to improve documentation
The keys of the error messages are actually attribute names. It makes
the documentation easier to understand:
# Returns +true+ if the error messages include an error for the given
# +attribute+, +false+ otherwise.
#
# person.errors.messages # => { :name => ["can not be nil"] }
# person.errors.include?(:name) # => true
# person.errors.include?(:age) # => false
def include?(attribute)
(v = messages[attribute]) && v.any?
end
Diffstat (limited to 'guides/assets')
0 files changed, 0 insertions, 0 deletions