Skip to content

Commit

Permalink
[merb-auth-core] Improved active_model compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
snusnu committed Sep 25, 2009
1 parent 5d1a78d commit 3ca6243
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions merb-auth-core/lib/merb-auth-core/errors.rb
Expand Up @@ -33,6 +33,17 @@ def full_messages
end
end

# Return validation errors for a particular field name or an empty array
#
# This method is a necessary requirement for active_model compatibility.
#
# @param [Symbol] field_name the name of the field you want an error for
# @return [Array<Array<String>>]
# array of validation errors or empty array, if there are no errors on given field
def [](field_name)
errors[field_name] ||= []
end

# Return authentication errors for a particular field_name.
#
# @param <Symbol> field_name the name of the field you want an error for
Expand Down

0 comments on commit 3ca6243

Please sign in to comment.