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
module ActiveRecord::Validations::ClassMethods | |
#inspired by rails-schema_validations | |
#https://github.com/gregwebs/rails-schema-validations | |
def add_generic_validations | |
begin | |
self.columns.map do |column| | |
case column.type | |
when :date | |
validates_format_of_date(column.name) #this is a custom validation we defined (not part of rails) | |
end |