search_me 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/search_me/filters.rb +5 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59d61823b49287334429aa027d097609b98e79bf
4
- data.tar.gz: a083b0960764653d68f3a5f667970e0a7ebbdc86
3
+ metadata.gz: 9b87a278deb122720428b013b9047e4f11adb837
4
+ data.tar.gz: 3692c3b696ae12f6a8b7a5d70d54d3f4c4747038
5
5
  SHA512:
6
- metadata.gz: c7c32b35467f1929570088d139e9930ebb1e3f86722debe6981f7bd9723c6b0c8c8fce226e19ae2245d21579fa375c1ef27b0ebeea96aaa7d1d49ad766a0feb0
7
- data.tar.gz: 4e3f3ea4753af52e0afd133c00fd5de242b4e570faad9d08734ed0c6e4e371cedca78bba19c3c4d30950a7f510aec926eeb49baa25defef63df813f7b6f7e32c
6
+ metadata.gz: 1b0286ce53c3a80fad1e9eeffc62406b42c61cc57198235b4b35d3621bbf4c100db43a847b1ee057c1527dc5db98160869d050d0fb19b25f7e42662173ac4937
7
+ data.tar.gz: 92e16c716568e91775ba2b17a1339b9e7720001b4aad5ab6d2957c73e5c561a7843eb37c755d4b29af8d431c8d27c1fbfb5af387007a2a0929a9aaa209915d82
@@ -76,12 +76,11 @@ module SearchMe
76
76
 
77
77
  private
78
78
  def build_between_query_for(duration)
79
- field = SearchMe.config.time_field
80
- in_created_at = "(#{field} > ? AND #{field} < ?)"
81
- on_created_at = "(#{field} = ?) OR (#{field} = ?)"
82
- self.where(
83
- "#{in_created_at} OR #{on_created_at}", *duration, *duration
84
- )
79
+ field = self.class.arel_table[SearchMe.config.time_field]
80
+ arel = field.eq(duration[0])
81
+ .or( field.gt(duration[0]).and(field.lt(duration[1])) )
82
+ .or( field.eq(duration[1]) )
83
+ where( arel )
85
84
  end
86
85
 
87
86
  def month_for_date(date)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-05 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Uses LIKE to search attributes and return any objects of the model for
14
14
  which a match is found