Module: ActiveScaffold::Finder

Defined in:
lib/active_scaffold/finder.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

NUMERIC_COMPARATORS =
[
  '=',
  '>=',
  '<=',
  '>',
  '<',
  '!=',
  'BETWEEN'
].freeze
STRING_COMPARATORS =
{
  :contains    => '%?%',
  :begins_with => '?%',
  :ends_with   => '%?',
  :doesnt_contain    => 'not_%?%',
  :doesnt_begin_with => 'not_?%',
  :doesnt_end_with   => 'not_%?'
}.freeze
NULL_COMPARATORS =
%w[null not_null].freeze
DATE_COMPARATORS =
%w[PAST FUTURE RANGE].freeze
DATE_UNITS =
%w[DAYS WEEKS MONTHS YEARS].freeze
TIME_UNITS =
%w[SECONDS MINUTES HOURS].freeze
DATE_RANGES =
%w[TODAY YESTERDAY TOMORROW THIS_WEEK PREV_WEEK NEXT_WEEK THIS_MONTH PREV_MONTH NEXT_MONTH THIS_YEAR PREV_YEAR NEXT_YEAR].freeze

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



497
498
499
# File 'lib/active_scaffold/finder.rb', line 497

def self.included(klass)
  klass.extend ClassMethods
end

.like_operatorObject



3
4
5
# File 'lib/active_scaffold/finder.rb', line 3

def self.like_operator
  @@like_operator ||= ::ActiveRecord::Base.connection.adapter_name.in?(%w[PostgreSQL PostGIS]) ? 'ILIKE' : 'LIKE'
end