encoded_id-rails 1.0.0.rc7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ef8577374a192378855b9f20acd2885770b3e49d379e3051a187db83f7de497
4
- data.tar.gz: 9f574a5e8336f3588bf55c1cb9f69f8b47bcfd46a689bc007abd6f7e0143b8e6
3
+ metadata.gz: 7e99068282cd5784294cc5d14e2c9b9d0a80604c1a2f585438e547fb0dd83bd4
4
+ data.tar.gz: e089cc0f30a7e18bc4034fa80ec11c9a48e69b89133fc6e283a912ca143c3bc8
5
5
  SHA512:
6
- metadata.gz: 33157300365c009da10a1a035d88aeeff2e021cace89194ab779a0ec598dd8acb6614444143f01efc3982ff68f320ce1cc2511909ca57ff1a18c712569510256
7
- data.tar.gz: '08879af617396021978d6b5a46833841a8362eca06a74d151cc36934200188526c5bacac5c57cd5abf84ee8e8816e31d7ae50277a5dae756608dca1c0c5f141c'
6
+ metadata.gz: 0156bd7504114ab4857e34851ec615511c5100f8d86a580078573e3d761e5475405a5399dbc089a26f34dcb234e92bd2685db693db509187f148658f6b56920d
7
+ data.tar.gz: 72d5b551086ac2e979cbde77bac313586d5c5e02f3f0f7c2e041eacfe5b44210ad6327f78da65a917b4ad97be28606548aadffd217528b6a067257e19a41534d
data/CHANGELOG.md CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  - nothing yet
4
4
 
5
- ## [1.0.0] - unreleased
5
+ ## [1.0.0] - 2025-11-21
6
6
 
7
7
  - First stable release!
8
8
 
9
9
  **Important!!: `:sqids` are not compatible with `:hashids`, DO NOT CHANGE FROM ONE TO THE OTHER AFTER GOING LIVE.**
10
10
 
11
+ ### Fixed (Rails integration)
12
+
13
+ - Ensure finder methods correctly override their ActiveRecord counterparts
14
+ - Warn when ActiveRecord integration used in model that doesn't use `id` as primary key
15
+
11
16
  ## [1.0.0.rc7] - 2025-11-19
12
17
 
13
18
  ### Breaking changes
@@ -18,10 +18,21 @@ module EncodedId
18
18
  if columns_hash["id"]&.type == :string
19
19
  ::Rails.logger.warn("EncodedId::Rails::ActiveRecordFinders has been included in #{name}, but this model uses string-based IDs. This may cause conflicts with encoded ID handling.")
20
20
  end
21
+
22
+ unless columns_hash.key?("id")
23
+ ::Rails.logger.warn("EncodedId::Rails::ActiveRecordFinders has been included in #{name}, but this model has no 'id' column. The finders will not work as expected.")
24
+ end
25
+
26
+ if primary_key && primary_key != "id" && columns_hash.key?("id")
27
+ ::Rails.logger.warn("EncodedId::Rails::ActiveRecordFinders has been included in #{name}, but the primary key is '#{primary_key}', not 'id'. This may cause unexpected behavior with find methods.")
28
+ end
29
+
30
+ # Use prepend so our methods take precedence over ActiveRecord's dynamic finders
31
+ singleton_class.prepend(ClassMethodsPrepend)
21
32
  end
22
33
 
23
34
  # Class methods for overriding ActiveRecord's finder methods to decode encoded IDs.
24
- module ClassMethods
35
+ module ClassMethodsPrepend
25
36
  # @rbs (*untyped args) -> untyped
26
37
  def find(*args)
27
38
  first_arg = args.first
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encoded_id-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ierodiaconou
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-11-20 00:00:00.000000000 Z
10
+ date: 2025-11-21 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -55,14 +55,14 @@ dependencies:
55
55
  requirements:
56
56
  - - '='
57
57
  - !ruby/object:Gem::Version
58
- version: 1.0.0.rc7
58
+ version: 1.0.0
59
59
  type: :runtime
60
60
  prerelease: false
61
61
  version_requirements: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - '='
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.0.rc7
65
+ version: 1.0.0
66
66
  description: ActiveRecord concern to use EncodedID to turn IDs into reversible and
67
67
  human friendly obfuscated strings.
68
68
  email: