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 +4 -4
- data/activerecord-where-any-of.gemspec +2 -2
- data/lib/active_record/where-any-of-mixin.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef5ed54bad29379534fe78509785670884e727a
|
4
|
+
data.tar.gz: 20680a21436a675196da93736f5a3ee737547d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
3
|
+
s.version = '1.0.6'
|
4
4
|
s.license = 'MIT'
|
5
|
-
s.date = '
|
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.
|
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:
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|