Module: ValidatesBySchema::ClassMethods

Defined in:
lib/validates_by_schema.rb

Instance Method Summary collapse

Instance Method Details

#load_schema!Object



19
20
21
22
23
24
25
26
27
# File 'lib/validates_by_schema.rb', line 19

def load_schema!
  super
  # Set flag here to avoid infinite recursion
  @schema_loaded = true

  # define schema validations lazy to avoid accessing the database
  # at class load time.
  define_schema_validations
end

#validates_by_schema(options = {}) ⇒ Object



14
15
16
17
# File 'lib/validates_by_schema.rb', line 14

def validates_by_schema(options = {})
  @validates_by_schema_options = options
  define_schema_validations if schema_loaded?
end