@@ -18,36 +18,6 @@ def self.config
18
18
@config
19
19
end
20
20
21
- configure do |config |
22
- predicates = {
23
- :contains => [ :contains ] ,
24
- :starts_with => [ :starts_with , :start_with ] ,
25
- :ends_with => [ :ends_with , :end_with ] ,
26
- :in => [ :in ] ,
27
- :eq => [ :eq , :equal , :equals ] ,
28
- :gt => [ :gt ] ,
29
- :gte => [ :gte , :gteq ] ,
30
- :lt => [ :lt ] ,
31
- :lte => [ :lte , :lteq ] ,
32
- }
33
- negative = proc { |p | "not_#{ p } " }
34
-
35
- config . add predicates [ :contains ] , :arel_predicate => :matches , :converter => proc { |v | "%#{ v } %" }
36
- config . add predicates [ :contains ] . map ( &negative ) , :arel_predicate => :does_not_match , :converter => proc { |v | "%#{ v } %" }
37
- config . add predicates [ :starts_with ] , :arel_predicate => :matches , :converter => proc { |v | "#{ v } %" }
38
- config . add predicates [ :starts_with ] . map ( &negative ) , :arel_predicate => :does_not_match , :converter => proc { |v | "#{ v } %" }
39
- config . add predicates [ :ends_with ] , :arel_predicate => :matches , :converter => proc { |v | "%#{ v } " }
40
- config . add predicates [ :ends_with ] . map ( &negative ) , :arel_predicate => :does_not_match , :converter => proc { |v | "%#{ v } " }
41
- config . add predicates [ :in ] , :arel_predicate => :in
42
- config . add predicates [ :in ] . map ( &negative ) , :arel_predicate => :not_in
43
- config . add predicates [ :eq ] , :arel_predicate => :eq
44
- config . add predicates [ :eq ] . map ( &negative ) , :ne , :arel_predicate => :not_eq
45
- config . add predicates [ :gt ] , :arel_predicate => :gt
46
- config . add predicates [ :gte ] , :arel_predicate => :gteq
47
- config . add predicates [ :lt ] , :arel_predicate => :lt
48
- config . add predicates [ :lte ] , :arel_predicate => :lteq
49
- end
50
-
51
21
ActiveSupport . on_load ( :active_record ) do
52
22
ActiveRecord ::Relation . send ( :include , Sakuramochi ::Relation )
53
23
ActiveRecord ::PredicateBuilder . send ( :include , Sakuramochi ::PredicateBuilder )
0 commit comments