Sha256: f8800d00e49e1456d0653b4f7e181130746558d57b51b6d7ff569885d2af0cf7
Contents?: true
Size: 569 Bytes
Versions: 21
Compression:
Stored size: 569 Bytes
Contents
# frozen_string_literal: true module PaidUp module Validators # Table Rows validator class TableRows < ActiveModel::Validator def validate(record) found_in = options[:found_in] if record.send(options[:field]) == options[:comparison] && !found_in_valid?(record, found_in) record.errors[found_in] << :when_using_table_rows_table_must_exist.l end end def found_in_valid?(record, found_in) ActiveRecord::Base.connection.data_source_exists? record.send(found_in) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems