activerecord_where_assoc 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/active_record_where_assoc/active_record_compat.rb +11 -1
- data/lib/active_record_where_assoc/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33267f5201fd0465cceec484dd0a2c91b3511b47289f500311e0d3a3946b28f
|
4
|
+
data.tar.gz: 0b1ef81c3b3106a0226ed72494523ce3a2ebb005f4b1401d6cca3917a78bfa26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156df4226e93a9d5a8e900a71b518d42ff984a47a8917d7d807429d3b473a5f8db7d392496c8f4dfda7f0746689b9127547d238b2f875846235c9075e4789f7b
|
7
|
+
data.tar.gz: fbea2c6d875f87c5b04d740fb6878d1f9ece9e11ba0053d38bbe6c8cb6311b194be770ebd402bc59a2baad10c3ecac8ee9f5e2bad8f6147ea152d8e8c2a96518
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# ActiveRecord Where Assoc
|
2
2
|
|
3
|
-
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/github/MaxLap/activerecord_where_assoc/badge.svg)](https://coveralls.io/github/MaxLap/activerecord_where_assoc)
|
3
|
+
![Test supported versions](https://github.com/MaxLap/activerecord_where_assoc/workflows/Test%20supported%20versions/badge.svg)
|
5
4
|
[![Code Climate](https://codeclimate.com/github/MaxLap/activerecord_where_assoc/badges/gpa.svg)](https://codeclimate.com/github/MaxLap/activerecord_where_assoc)
|
6
|
-
[![Issue Count](https://codeclimate.com/github/MaxLap/activerecord_where_assoc/badges/issue_count.svg)](https://codeclimate.com/github/MaxLap/activerecord_where_assoc)
|
7
5
|
|
8
6
|
This gem makes it easy to do conditions based on the associations of your records in ActiveRecord (Rails). (Using SQL's `EXISTS` operator)
|
9
7
|
|
@@ -39,7 +37,7 @@ These methods have many advantages over the alternative ways of achieving the si
|
|
39
37
|
|
40
38
|
## Installation
|
41
39
|
|
42
|
-
Rails 4.1 to 6.
|
40
|
+
Rails 4.1 to 6.1 are supported with Ruby 2.1 to 2.7.
|
43
41
|
Tested against SQLite3, PostgreSQL and MySQL.
|
44
42
|
The gem only depends on the `activerecord` gem.
|
45
43
|
|
@@ -2,7 +2,17 @@
|
|
2
2
|
|
3
3
|
module ActiveRecordWhereAssoc
|
4
4
|
module ActiveRecordCompat
|
5
|
-
if ActiveRecord.gem_version >= Gem::Version.new("
|
5
|
+
if ActiveRecord.gem_version >= Gem::Version.new("6.1.0.rc1")
|
6
|
+
JoinKeys = Struct.new(:key, :foreign_key)
|
7
|
+
def self.join_keys(reflection, poly_belongs_to_klass)
|
8
|
+
if poly_belongs_to_klass
|
9
|
+
JoinKeys.new(reflection.join_primary_key(poly_belongs_to_klass), reflection.join_foreign_key)
|
10
|
+
else
|
11
|
+
JoinKeys.new(reflection.join_primary_key, reflection.join_foreign_key)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
elsif ActiveRecord.gem_version >= Gem::Version.new("5.1")
|
6
16
|
def self.join_keys(reflection, poly_belongs_to_klass)
|
7
17
|
if poly_belongs_to_klass
|
8
18
|
reflection.get_join_keys(poly_belongs_to_klass)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_where_assoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Handfield Lapointe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: coveralls
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: deep-cover
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|