Module: AutoValidate

Included in:
ActiveRecord::Base
Defined in:
lib/auto_validate.rb,
lib/auto_validate/version.rb

Constant Summary collapse

VERSION =
"0.0.4"

Instance Method Summary collapse

Instance Method Details

#auto_validateObject



71
72
73
74
75
76
77
78
79
80
# File 'lib/auto_validate.rb', line 71

def auto_validate
  if connection.table_exists?(table_name)
    self.defined_primary_key = locate_primary_key
    self.attributes = load_attributes
    self.indexes = load_unique_indexes
    add_validates_presence_of_and_boolean_validations
    add_validates_uniqueness_of
    add_validates_numericality_of
  end
end