activerecord-where-any-of 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0e626da34af089d9f92dcf9ee6d5b97395ffdb4
4
- data.tar.gz: 891e420029939a94032a74d6f937caddf6177dc2
3
+ metadata.gz: fef5ed54bad29379534fe78509785670884e727a
4
+ data.tar.gz: 20680a21436a675196da93736f5a3ee737547d84
5
5
  SHA512:
6
- metadata.gz: 75c4e9ad19c7ab0132add54522a76d2815143ef36059b340f5f181c8d0a0d55989bfbc38aba429bcfb5ab95cbee685739538bd95f56c3528cc4aa096e55cea06
7
- data.tar.gz: 784d559cd7de12e7a60599eed0ecaeb5c3cf95c2b448bb19537ef07260cdfad17f5db4e7bdd9aecaab2e523f6bc685626e54973f369396d5de177aaff7ca8396
6
+ metadata.gz: cbe1832d8d6b711ce196c91808edc0c34fe6384d959b4d39f6d1943e99dfa69b6d2878f63cfe2e82b76881f968e3fd2f3c17b1ea3def9731f7c1786ca0ce3551
7
+ data.tar.gz: 0637588ca5ed891adb966c8dafc45c4ad9adf650569463e73f776fbe33a79f0cf4d35fc8603bd47a63b04bc5ee656358bd1d3e934aefe774d8d1f742be5d9660
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'activerecord-where-any-of'
3
- s.version = '1.0.5'
3
+ s.version = '1.0.6'
4
4
  s.license = 'MIT'
5
- s.date = '2014-07-24'
5
+ s.date = '2015-12-28'
6
6
  s.summary = 'A simple mixin to ActiveRecord::Base that allows use of OR arel relations.'
7
7
  s.description = '...'
8
8
  s.description = File.read(File.expand_path('../README.md', __FILE__))[/Description:\n-+\s*(.*?)\n\n/m, 1]
@@ -8,10 +8,21 @@ module ActiveRecord
8
8
  if c.is_a? Symbol or c.is_a? String
9
9
  c = self.unscoped.send(c)
10
10
  end
11
- c.where_values.reduce(:and)
11
+ __convert_string_wheres(c.where_values).reduce(:and)
12
12
  end
13
13
  where(conditions.reduce(:or))
14
14
  end
15
15
 
16
+ def __convert_string_wheres(wheres)
17
+ wheres.map do |w|
18
+ if w.is_a?(Arel::Nodes::Equality)
19
+ w
20
+ else
21
+ w = Arel.sql(w) if String === w
22
+ Arel::Nodes::Grouping.new(w)
23
+ end
24
+ end
25
+ end
26
+
16
27
  end
17
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-where-any-of
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David McCullars
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-24 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord