Module: ValidatesBySchema::ClassMethods

Defined in:
lib/validates_by_schema.rb

Instance Method Summary collapse

Instance Method Details

#validates_by_schema(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/validates_by_schema.rb', line 8

def validates_by_schema(options = {})
  return unless table_exists?

  customized_columns(options).each do |c|
    ValidationOption.new(self, c).define!
  end

rescue ::ActiveRecord::NoDatabaseError
  # Since `db:create` and other tasks from Rails 5.2.0 might load models,
  # we need to swallow this error to execute `db:create` properly.
end