Created
August 2, 2008 20:02
-
-
Save teamon/3771 to your computer and use it in GitHub Desktop.
undefined
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
if defined?(Validate) | |
module Validate | |
module AutoValidate | |
alias :orig_auto_generate_validations, :auto_generate_validations | |
def auto_generate_validations(property) | |
orig_auto_generate_validations(property) | |
return unless property.options[:auto_validation] | |
if property.type.ancestors.include?(Types::Enum) | |
validates_within property.name, options_with_message({:set => property.type.flag_map.values}, property, :within) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment