Sha256: 231af83d1bf1a1bbc5111024c4d7594e6a8b8214fb4cc164e38ddd9171dc63ca

Contents?: true

Size: 344 Bytes

Versions: 14

Compression:

Stored size: 344 Bytes

Contents

module PaidUp
  class TableValidator < ActiveModel::Validator
    def validate(record)
      if record.send(options[:field]) == options[:comparison] && !ActiveRecord::Base.connection.table_exists?(record.send(options[:found_in]))
        record.errors[options[:found_in]] << :when_using_table_rows_table_must_exist.l
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
paid_up-0.2.4 lib/paid_up/table_validator.rb
paid_up-0.2.3 lib/paid_up/table_validator.rb
paid_up-0.2.2 lib/paid_up/table_validator.rb
paid_up-0.2.1 lib/paid_up/table_validator.rb
paid_up-0.2.0 lib/paid_up/table_validator.rb
paid_up-0.1.9 lib/paid_up/table_validator.rb
paid_up-0.1.8 lib/paid_up/table_validator.rb
paid_up-0.1.7 lib/paid_up/table_validator.rb
paid_up-0.1.6 lib/paid_up/table_validator.rb
paid_up-0.1.5 lib/paid_up/table_validator.rb
paid_up-0.1.4 lib/paid_up/table_validator.rb
paid_up-0.1.3 lib/paid_up/table_validator.rb
paid_up-0.1.1 lib/paid_up/table_validator.rb
paid_up-0.1.0 lib/paid_up/table_validator.rb