lib/acts_as_data_table/scope_filters/validator.rb
#
# Validates that all given arguments with names of the format /[a-z]+_id/
# actually refer to valid records in the system
#
Validates that all given arguments with names of the format /[a-z]+_id
actually refer to valid records in the system
Validates that all given arguments with names of the format / [ a - z ] + _id actually refer to valid records in the system
def validate_record_existence
          validate_all :invalid_record do |k, v|
            m = /([a-z]+)_id/.match(k.to_s)
            if m
              model  = m[1].camelize.constantize
              !!model.find_by_id(v)
            else
              true
            end
          end
        end
def validate_record_existence validate_all :invalid_record do | k , v | m = / ([a-z]+)_id / . match ( k . to_s ) if m model = m [ 1 ] . camelize . constantize ! ! model . find_by_id ( v ) else true end end end
Validates that all given arguments with names of the format /[a-z]+_id
actually refer to valid records in the system
Validates that all given arguments with names of the format / [ a - z ] + _id actually refer to valid records in the system