torque-postgresql 2.4.3 → 2.4.4
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: 3533ab897fec6762e3d3165d9b4795bf3167409724bfc9c77acd845747ee698c
|
4
|
+
data.tar.gz: 76e868de2923ff393e4fe8f9a836a4cd258588726e522811515b70bec1f5afbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886466cc45f9581d18e7fabf3a287ad17b318be0a447fe611f33aa403e63e74de25d9f230f5ddf1475c6dc12e3658d54e98378af57ec8c92d7e5d6503e87a033
|
7
|
+
data.tar.gz: 0a940cb293cf793e5ca884203b328f346b0276ada4a1ea682ec0677c051d415c31f31abcb27dd2d27c197060335d8117556d87607367f4bc8b81a8a104e95280
|
@@ -25,7 +25,7 @@ module Torque
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def foreign_key
|
28
|
-
@foreign_key ||= options[:foreign_key] || derive_foreign_key.freeze
|
28
|
+
@foreign_key ||= options[:foreign_key]&.to_s || derive_foreign_key.freeze
|
29
29
|
end
|
30
30
|
|
31
31
|
def association_foreign_key
|
@@ -33,7 +33,7 @@ module Torque
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def active_record_primary_key
|
36
|
-
@active_record_primary_key ||= options[:primary_key] || derive_primary_key
|
36
|
+
@active_record_primary_key ||= options[:primary_key]&.to_s || derive_primary_key
|
37
37
|
end
|
38
38
|
|
39
39
|
def join_primary_key(*)
|
@@ -20,6 +20,14 @@ RSpec.describe 'BelongsToMany' do
|
|
20
20
|
|
21
21
|
model.belongs_to_many(:tests)
|
22
22
|
end
|
23
|
+
|
24
|
+
it 'allows setting up foreign key and primary_key as symbol' do
|
25
|
+
model.belongs_to_many(:tests, foreign_key: :test_ids, primary_key: :test_id)
|
26
|
+
|
27
|
+
reflection = model._reflections['tests']
|
28
|
+
expect(reflection.foreign_key).to be_eql('test_ids')
|
29
|
+
expect(reflection.active_record_primary_key).to be_eql('test_id')
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
context 'on association' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torque-postgresql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|