From 903d58840f62257529d967de81617bcf75754fbf Mon Sep 17 00:00:00 2001 From: Zhomart Mukhamejanov Date: Fri, 31 Oct 2014 11:50:39 -0700 Subject: [PATCH] Common constants of adapters moved to ransack/constants.rb --- .../active_record/ransack/constants.rb | 17 ----------------- lib/ransack/constants.rb | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/ransack/adapters/active_record/ransack/constants.rb b/lib/ransack/adapters/active_record/ransack/constants.rb index 116e5f9..168331e 100644 --- a/lib/ransack/adapters/active_record/ransack/constants.rb +++ b/lib/ransack/adapters/active_record/ransack/constants.rb @@ -1,23 +1,6 @@ module Ransack module Constants - ASC = 'asc'.freeze - DESC = 'desc'.freeze - ASC_ARROW = '▲'.freeze - DESC_ARROW = '▼'.freeze - OR = 'or'.freeze - AND = 'and'.freeze - SORT = 'sort'.freeze - SORT_LINK = 'sort_link'.freeze - SEARCH = 'search'.freeze - DEFAULT_SEARCH_KEY = 'q'.freeze - ATTRIBUTE = 'attribute'.freeze DISTINCT = 'DISTINCT '.freeze - COMBINATOR = 'combinator'.freeze - SPACE = ' '.freeze - COMMA_SPACE = ', '.freeze - UNDERSCORE = '_'.freeze - NON_BREAKING_SPACE = ' '.freeze - EMPTY = ''.freeze STRING_JOIN = 'string_join'.freeze ASSOCIATION_JOIN = 'association_join'.freeze STASHED_JOIN = 'stashed_join'.freeze diff --git a/lib/ransack/constants.rb b/lib/ransack/constants.rb index 1e2c80b..0d701c1 100644 --- a/lib/ransack/constants.rb +++ b/lib/ransack/constants.rb @@ -1,5 +1,23 @@ module Ransack module Constants + ASC = 'asc'.freeze + DESC = 'desc'.freeze + ASC_ARROW = '▲'.freeze + DESC_ARROW = '▼'.freeze + OR = 'or'.freeze + AND = 'and'.freeze + SORT = 'sort'.freeze + SORT_LINK = 'sort_link'.freeze + SEARCH = 'search'.freeze + DEFAULT_SEARCH_KEY = 'q'.freeze + ATTRIBUTE = 'attribute'.freeze + COMBINATOR = 'combinator'.freeze + SPACE = ' '.freeze + COMMA_SPACE = ', '.freeze + UNDERSCORE = '_'.freeze + NON_BREAKING_SPACE = ' '.freeze + EMPTY = ''.freeze + TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE'].to_set BOOLEAN_VALUES = TRUE_VALUES + FALSE_VALUES