pacecar 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pacecar/datetime.rb +6 -6
- data/lib/pacecar/search.rb +3 -0
- metadata +2 -2
data/lib/pacecar/datetime.rb
CHANGED
@@ -22,28 +22,28 @@ module Pacecar
|
|
22
22
|
|
23
23
|
def define_before_after_scopes(name)
|
24
24
|
named_scope "#{name}_before".to_sym, lambda { |time|
|
25
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
25
|
+
{ :conditions => ["#{quoted_table_name}.#{name} <= ?", time] }
|
26
26
|
}
|
27
27
|
named_scope "#{name}_after".to_sym, lambda { |time|
|
28
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
28
|
+
{ :conditions => ["#{quoted_table_name}.#{name} >= ?", time] }
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
32
|
def define_past_future_scopes(name)
|
33
33
|
named_scope "#{name}_in_past", lambda {
|
34
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
34
|
+
{ :conditions => ["#{quoted_table_name}.#{name} <= ?", Time.now] }
|
35
35
|
}
|
36
36
|
named_scope "#{name}_in_future", lambda {
|
37
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
37
|
+
{ :conditions => ["#{quoted_table_name}.#{name} >= ?", Time.now] }
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
41
|
def define_inside_outside_scopes(name)
|
42
42
|
named_scope "#{name}_inside".to_sym, lambda { |start, stop|
|
43
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
43
|
+
{ :conditions => ["#{quoted_table_name}.#{name} >= ? and #{quoted_table_name}.#{name} <= ?", start, stop] }
|
44
44
|
}
|
45
45
|
named_scope "#{name}_outside".to_sym, lambda { |start, stop|
|
46
|
-
{ :conditions => ["#{quoted_table_name}.#{name}
|
46
|
+
{ :conditions => ["#{quoted_table_name}.#{name} <= ? and #{quoted_table_name}.#{name} >= ?", start, stop] }
|
47
47
|
}
|
48
48
|
end
|
49
49
|
|
data/lib/pacecar/search.rb
CHANGED
@@ -14,6 +14,9 @@ module Pacecar
|
|
14
14
|
|
15
15
|
def define_search_scopes
|
16
16
|
text_and_string_column_names.each do |name|
|
17
|
+
named_scope "#{name}_equals".to_sym, lambda { |query|
|
18
|
+
{ :conditions => ["#{quoted_table_name}.#{name} = :query", { :query => query }] }
|
19
|
+
}
|
17
20
|
named_scope "#{name}_matches".to_sym, lambda { |query|
|
18
21
|
{ :conditions => ["#{quoted_table_name}.#{name} like :query", { :query => "%#{query}%" }] }
|
19
22
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacecar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Jankowski
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-13 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|