active_house 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_house/querying/collect.rb +11 -1
- data/lib/active_house/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18ed7462f45a3c4c20e190c742688c9a8ec6e0f4
|
4
|
+
data.tar.gz: d096f13e19a63f47f3f65bf140fc77ec5fda2de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee3e82a8e3cae6756b103ee3c2cd75cf482abbb0d372cd59690af07dd9e90093a743f3736608b1f03578830b870413358e77302f804339919eabe223652c81f8
|
7
|
+
data.tar.gz: 98dc615c0770051b73692782a2305e3b4236f74127c909cee9e0a03b1a59fc3509d8e48e9fc2eca7ada2dee0071ec74a8d53257bbab9f2c8ab2bba6ab53a94de
|
@@ -87,9 +87,19 @@ module ActiveHouse
|
|
87
87
|
values[:group_by].empty? ? nil : values[:group_by]
|
88
88
|
end
|
89
89
|
|
90
|
+
def pluck(*fields)
|
91
|
+
result = except(:select).select(*fields).to_hashes
|
92
|
+
return [] if result.empty?
|
93
|
+
if result.first.keys.size == 1
|
94
|
+
result.map { |row| row.values.first }
|
95
|
+
else
|
96
|
+
result.map(&:values)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
90
100
|
def count(value = 'COUNT() AS cnt')
|
91
101
|
return 0 if group_values
|
92
|
-
except(:select, :limit, :offset, :order).
|
102
|
+
except(:select, :limit, :offset, :order).pluck(value).first
|
93
103
|
end
|
94
104
|
|
95
105
|
end
|
data/lib/active_house/version.rb
CHANGED