Sha256: 8b01f40f9140aae6fcd470054cc20787fa2e7fab5e19ccc467684dc90f896a90

Contents?: true

Size: 468 Bytes

Versions: 16

Compression:

Stored size: 468 Bytes

Contents

module PaidUp
  module Validators
    # Table Rows validator
    class TableRows < 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
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
paid_up-0.11.7 lib/paid_up/validators/table_rows.rb
paid_up-0.11.6 lib/paid_up/validators/table_rows.rb
paid_up-0.11.5 lib/paid_up/validators/table_rows.rb
paid_up-0.11.4 lib/paid_up/validators/table_rows.rb
paid_up-0.11.3 lib/paid_up/validators/table_rows.rb
paid_up-0.11.2 lib/paid_up/validators/table_rows.rb
paid_up-0.11.1 lib/paid_up/validators/table_rows.rb
paid_up-0.11.0 lib/paid_up/validators/table_rows.rb
paid_up-0.10.4 lib/paid_up/validators/table_rows.rb
paid_up-0.10.3 lib/paid_up/validators/table_rows.rb
paid_up-0.10.2 lib/paid_up/validators/table_rows.rb
paid_up-0.10.1 lib/paid_up/validators/table_rows.rb
paid_up-0.10.0 lib/paid_up/validators/table_rows.rb
paid_up-0.9.16 lib/paid_up/validators/table_rows.rb
paid_up-0.9.15 lib/paid_up/validators/table_rows.rb
paid_up-0.9.14 lib/paid_up/validators/table_rows.rb