Guest User

Untitled

a guest
Feb 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. if defined?(Validate)
  2. module Validate
  3. module AutoValidate
  4. alias :orig_auto_generate_validations, :auto_generate_validations
  5. def auto_generate_validations(property)
  6. orig_auto_generate_validations(property)
  7. return unless property.options[:auto_validation]
  8.  
  9. if property.type.ancestors.include?(Types::Enum)
  10. validates_within property.name, options_with_message({:set => property.type.flag_map.values}, property, :within)
  11. end
  12. end
  13. end
  14. end
  15. end
Add Comment
Please, Sign In to add comment