Created
February 7, 2011 18:35
-
-
Save spastorino/814911 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb | |
index a0f9045..efd071f 100644 | |
--- a/activemodel/lib/active_model/validations.rb | |
+++ b/activemodel/lib/active_model/validations.rb | |
@@ -147,9 +147,9 @@ module ActiveModel | |
# List all validators that being used to validate a specific attribute. | |
def validators_on(*attributes) | |
- attributes.inject([]) do |all, attribute| | |
- all |= _validators[attribute.to_sym] || [] | |
- end | |
+ attributes.map do |attribute| | |
+ _validators[attribute.to_sym] | |
+ end.flatten | |
end | |
# Check if method is an attribute method or not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment