active_record_distinct_on 1.1.0 → 1.4.0
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
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '03806e7bb7b654ef57351d1b7123f4f07084e256eeb564a4d325b21e2f41bede'
|
4
|
+
data.tar.gz: 889c8a393d6c907bae4bb78afe291521e7fafd74f4b77f6190d07cbe39197acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81b62213427b5a7bf5b18b63a508cd0cd454b6b6ae069817b28be2816c5c3df14698cd178589fbd7fcd693d74c3da664b7f867cf36c6ecffa3666bbc10b09ac5
|
7
|
+
data.tar.gz: d61728b40cd13d642a6cdb0e73a5e4a9287878d6fbc31ca849eb4c02874bbfd4d467fe4764e862c8ce9e2a8b899724012549fc928a3a62eeef1316ead07297f7
|
@@ -28,13 +28,6 @@ module ActiveRecordDistinctOn
|
|
28
28
|
|
29
29
|
def distinct_on!(*fields)
|
30
30
|
fields.flatten!
|
31
|
-
fields.map! { |field|
|
32
|
-
if klass.attribute_alias?(field)
|
33
|
-
arel_attribute(klass.attribute_alias(field).to_sym)
|
34
|
-
else
|
35
|
-
arel_attribute(field)
|
36
|
-
end
|
37
|
-
}
|
38
31
|
self.distinct_on_values += fields
|
39
32
|
self
|
40
33
|
end
|
@@ -48,7 +41,16 @@ module ActiveRecordDistinctOn
|
|
48
41
|
end
|
49
42
|
|
50
43
|
def build_distinct_on(arel, columns)
|
51
|
-
|
44
|
+
return if columns.empty?
|
45
|
+
|
46
|
+
arel_attributes = columns.map { |field|
|
47
|
+
if klass.attribute_alias?(field)
|
48
|
+
arel_table[klass.attribute_alias(field).to_sym]
|
49
|
+
else
|
50
|
+
arel_table[field]
|
51
|
+
end
|
52
|
+
}
|
53
|
+
arel.distinct_on(arel_columns arel_attributes)
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_distinct_on
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alec Larsen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,16 +76,16 @@ dependencies:
|
|
76
76
|
name: simplecov
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0
|
81
|
+
version: '0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0
|
88
|
+
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: pry
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ homepage: https://github.com/alecdotninja/active_record_distinct_on
|
|
147
147
|
licenses:
|
148
148
|
- MIT
|
149
149
|
metadata: {}
|
150
|
-
post_install_message:
|
150
|
+
post_install_message:
|
151
151
|
rdoc_options: []
|
152
152
|
require_paths:
|
153
153
|
- lib
|
@@ -162,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
-
signing_key:
|
165
|
+
rubygems_version: 3.2.31
|
166
|
+
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Adds support for `DISTINCT ON` statements when querying with ActiveRecord
|
169
169
|
test_files: []
|