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: 19cfac9293a2758ae928a2d1a8ab7aaf37b8d7ba1943f24c89b37eae28c04fa8
4
- data.tar.gz: 213df2558e23565ab99f4a36feb7733e59437ddfe36b01f44d2603570f92f39f
3
+ metadata.gz: 3533ab897fec6762e3d3165d9b4795bf3167409724bfc9c77acd845747ee698c
4
+ data.tar.gz: 76e868de2923ff393e4fe8f9a836a4cd258588726e522811515b70bec1f5afbd
5
5
  SHA512:
6
- metadata.gz: 34df30f7080d5b44a59b59011a1f1751c122fa8aa9df50facfadb2b3a051547f922d03dfdb374b027c004dc5c757b84d655938f34ece4f48423556cccd7c5485
7
- data.tar.gz: b63f3250fc36a88b39a66750e577eda7b734a621f8176dabde7eacbb2cf50d00b1db7fe451286210fefc3c5f43fb624f447290a55cd286611f9cc08e98e1ea35
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(*)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Torque
4
4
  module PostgreSQL
5
- VERSION = '2.4.3'
5
+ VERSION = '2.4.4'
6
6
  end
7
7
  end
@@ -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.3
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-13 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails