torque-postgresql 3.3.2 → 3.3.3
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: 7afebc02d5b903b8ddb8cfdee36ff8260d1c82977943f2fadbb63771902c6c44
|
4
|
+
data.tar.gz: 89a55ffc034942f5b49dac3693fc3ed95fc6a0d49a01586c2b58a0c26086e2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 168d3558d8ba7ac6862b39301381edcfd23a208bfd24293fc957a53243327b561d1063fc794bbedf741bcca12cd6fd3f3460999b3674300ed6f1171e510fcc51
|
7
|
+
data.tar.gz: '09859ddf3c06760d276fe25df11e8817168115cbea4ce971b86884ef3ed39428cc0292a885c10300e720d9a1b2f1c3da35dff40532f24fab96f13bb4b122f19c'
|
@@ -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
|
@@ -359,7 +367,7 @@ RSpec.describe 'BelongsToMany' do
|
|
359
367
|
expect { query.load }.not_to raise_error
|
360
368
|
end
|
361
369
|
|
362
|
-
context '
|
370
|
+
context 'when the attribute has a default value' do
|
363
371
|
subject { FactoryBot.create(:item) }
|
364
372
|
|
365
373
|
it 'will always return the column default value' do
|
@@ -382,7 +390,7 @@ RSpec.describe 'BelongsToMany' do
|
|
382
390
|
end
|
383
391
|
end
|
384
392
|
|
385
|
-
context '
|
393
|
+
context 'when record is not persisted' do
|
386
394
|
let(:initial) { FactoryBot.create(:tag) }
|
387
395
|
|
388
396
|
subject { Video.new(title: 'A', tags: [initial]) }
|
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: 3.3.
|
4
|
+
version: 3.3.3
|
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
|