lite-uxid 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +9 -1
- data/lib/generators/lite/uxid/templates/install.rb +1 -0
- data/lib/lite/uxid/record/hashid.rb +3 -1
- data/lib/lite/uxid/record/nanoid.rb +2 -1
- data/lib/lite/uxid/record/ulid.rb +2 -1
- data/lib/lite/uxid/record/uuid.rb +2 -1
- data/lib/lite/uxid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c35d2426c2fffc91f8195a96c94ff26df0c41ffdb79041c5499952c93ccd240
|
4
|
+
data.tar.gz: 5a72d11d4fc6d3cec87411a623d072dec4ba1f17b810814b15c543da3a512d7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a84caf603e6393456ac15d30afaf23fda68eec1480997ce64a54339abefcfc5fadf1afe4fb505f6b3f54119188e3f3405e040771e4a76cc4cae3f8b7f842693
|
7
|
+
data.tar.gz: 0d345ae245719fcfe669230925aee58feab58153c978c6089379cc750ae417325d98bd6b660aba695e2df85d540d88a543bfd5a11ce88556fb2ef835f81a860d
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.5.1] - 2024-09-20
|
10
|
+
### Changed
|
11
|
+
- Use after commit on create instead of after create
|
12
|
+
|
9
13
|
## [1.5.0] - 2024-09-20
|
10
14
|
### Added
|
11
15
|
- Added uuid version option
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -126,7 +126,15 @@ Passable options are:
|
|
126
126
|
Add the following attribute to all corresponding tables.
|
127
127
|
|
128
128
|
```ruby
|
129
|
-
|
129
|
+
# NOTE: null: true has to be set for HashID's
|
130
|
+
# since an ID must exist before it gets created.
|
131
|
+
t.string :uxid, null: false, index: { unique: true }
|
132
|
+
```
|
133
|
+
|
134
|
+
If using UUID and your database supports it:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
t.uuid :uxid, null: false, index: { unique: true }
|
130
138
|
```
|
131
139
|
|
132
140
|
**Setup**
|
@@ -10,7 +10,9 @@ module Lite
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
|
13
|
+
after_commit :callback_generate_uxid!,
|
14
|
+
if: proc { respond_to?(:uxid) && !uxid? },
|
15
|
+
on: :create
|
14
16
|
end
|
15
17
|
|
16
18
|
class_methods do
|
@@ -10,7 +10,8 @@ module Lite
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
before_create :callback_generate_uxid!,
|
13
|
+
before_create :callback_generate_uxid!,
|
14
|
+
if: proc { respond_to?(:uxid) && !uxid? }
|
14
15
|
end
|
15
16
|
|
16
17
|
def uxid_prefix
|
data/lib/lite/uxid/version.rb
CHANGED