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 +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/encoded_id/rails/active_record_finders.rb +12 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e99068282cd5784294cc5d14e2c9b9d0a80604c1a2f585438e547fb0dd83bd4
|
|
4
|
+
data.tar.gz: e089cc0f30a7e18bc4034fa80ec11c9a48e69b89133fc6e283a912ca143c3bc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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] -
|
|
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
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
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:
|