rodauth-model 0.4.0 → 0.5.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 +4 -0
- data/README.md +1 -1
- data/lib/rodauth/model/active_record.rb +1 -1
- data/lib/rodauth/model/sequel.rb +2 -2
- data/lib/rodauth/model.rb +9 -0
- data/rodauth-model.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 239885866a591579de9572aeef88130ee45bebcdd2950b590471d9b2e2de14ad
|
|
4
|
+
data.tar.gz: 4b507ce9b6fe74cda28363956504f60781e0ed2177c0f30aac287f6a4b65fdac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0ef6938063f04122115959b51d833c8f84441526e721493a5af518c7758dcabcf4022b7a0701e6dc69ba098b4519fd35126952b15b56ac3465d0e18ad31f9fa
|
|
7
|
+
data.tar.gz: bbf525d94b4533f11485428f258fd3963e79b896a2dfeebc9240565ae25e5e12d5c5eeb86fa6e96ad05d4075cb2a8f03b3c289246d1c4569d5f3e11ea7aafabe
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.5.0 (2026-06-29)
|
|
2
|
+
|
|
3
|
+
* Don't define the password hash association when no password feature is enabled, which previously failed on `Account#destroy` for setups such as OmniAuth-only authentication (@janko)
|
|
4
|
+
|
|
1
5
|
## 0.4.0 (2024-12-16)
|
|
2
6
|
|
|
3
7
|
* Add `password?` model method that returns whether a password is set (@janko)
|
data/README.md
CHANGED
|
@@ -152,7 +152,7 @@ if defined?(Rodauth::Model)
|
|
|
152
152
|
end
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
The `Rodauth::Model.register_association` method receives the feature name and a block, which is
|
|
155
|
+
The `Rodauth::Model.register_association` method receives the feature name and a block, which is evaluated in the context of a Rodauth instance and should return the association definition with the following items:
|
|
156
156
|
|
|
157
157
|
* `:name` – association name
|
|
158
158
|
* `:type` – relationship type (`:one` for one-to-one, `:many` for one-to-many)
|
|
@@ -43,7 +43,7 @@ module Rodauth
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def define_associations(model)
|
|
46
|
-
define_password_hash_association(model)
|
|
46
|
+
define_password_hash_association(model) if password_hash_association?
|
|
47
47
|
|
|
48
48
|
feature_associations.each do |association|
|
|
49
49
|
association[:type] = ASSOCIATION_TYPES.fetch(association[:type])
|
data/lib/rodauth/model/sequel.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Rodauth
|
|
|
14
14
|
def define_methods(model)
|
|
15
15
|
rodauth = @auth_class.allocate.freeze
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
if password_hash_association?
|
|
18
18
|
model.plugin :nested_attributes
|
|
19
19
|
model.nested_attributes :password_hash, destroy: true
|
|
20
20
|
end
|
|
@@ -55,7 +55,7 @@ module Rodauth
|
|
|
55
55
|
def define_associations(model)
|
|
56
56
|
model.plugin :association_dependencies
|
|
57
57
|
|
|
58
|
-
define_password_hash_association(model)
|
|
58
|
+
define_password_hash_association(model) if password_hash_association?
|
|
59
59
|
|
|
60
60
|
feature_associations.each do |association|
|
|
61
61
|
association[:type] = ASSOCIATION_TYPES.fetch(association[:type])
|
data/lib/rodauth/model.rb
CHANGED
|
@@ -52,6 +52,15 @@ module Rodauth
|
|
|
52
52
|
.map { |block| rodauth.instance_exec(&block) }
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# The password hash is stored in a separate table only when Rodauth is
|
|
56
|
+
# configured to manage passwords (i.e. when a password-handling feature is
|
|
57
|
+
# enabled). Without this check we'd define an association against a table
|
|
58
|
+
# that doesn't exist, which would fail on Account#destroy.
|
|
59
|
+
def password_hash_association?
|
|
60
|
+
!rodauth.account_password_hash_column &&
|
|
61
|
+
rodauth.features.include?(:login_password_requirements_base)
|
|
62
|
+
end
|
|
63
|
+
|
|
55
64
|
def rodauth
|
|
56
65
|
@auth_class.allocate
|
|
57
66
|
end
|
data/rodauth-model.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rodauth-model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Janko Marohnić
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rodauth
|
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
158
|
version: '0'
|
|
159
159
|
requirements: []
|
|
160
|
-
rubygems_version:
|
|
160
|
+
rubygems_version: 4.0.13
|
|
161
161
|
specification_version: 4
|
|
162
162
|
summary: Provides model mixin for Active Record and Sequel that defines password attribute
|
|
163
163
|
and associations based on Rodauth configuration.
|