activemodel 7.0.3 → 7.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/lib/active_model/attribute_methods.rb +1 -1
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/secure_password.rb +24 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630260cc44166916794fb7e43002e72a303ff43b834e82e530cff1f13f25ee7f
|
4
|
+
data.tar.gz: f136cec57987c03ab4aa3fba2b65fe2964b010a326e28cdc0d32f755b45612f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b16a3dd6f96bf2ec1bfa5e3abba2e513567b12035e34e8ea30c24fb8a08ca70089d394f5daa0f40fdc4e14fb63470593904a5a335f864782983c719cf0d57d2
|
7
|
+
data.tar.gz: 66f3f86fcf4b90ffbab8ea82777ac2df48f1774f7ff528d44ec81e12ea47cb2050309b5535e9e960757eb8f9350efa9c6a128754c3b117fdedef3e3c42a43765
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## Rails 7.0.4 (September 09, 2022) ##
|
2
|
+
|
3
|
+
* Handle name clashes in attribute methods code generation cache.
|
4
|
+
|
5
|
+
When two distinct attribute methods would generate similar names,
|
6
|
+
the first implementation would be incorrectly re-used.
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
class A
|
10
|
+
attribute_method_suffix "_changed?"
|
11
|
+
define_attribute_methods :x
|
12
|
+
end
|
13
|
+
|
14
|
+
class B
|
15
|
+
attribute_method_suffix "?"
|
16
|
+
define_attribute_methods :x_changed
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
*Jean Boussier*
|
21
|
+
|
22
|
+
## Rails 7.0.3.1 (July 12, 2022) ##
|
23
|
+
|
24
|
+
* No changes.
|
25
|
+
|
26
|
+
|
1
27
|
## Rails 7.0.3 (May 09, 2022) ##
|
2
28
|
|
3
29
|
* No changes.
|
@@ -394,7 +394,7 @@ module ActiveModel
|
|
394
394
|
mangled_name = "__temp__#{name.unpack1("h*")}"
|
395
395
|
end
|
396
396
|
|
397
|
-
code_generator.define_cached_method(name, as: mangled_name, namespace: namespace) do |batch|
|
397
|
+
code_generator.define_cached_method(name, as: mangled_name, namespace: :"#{namespace}_#{target}") do |batch|
|
398
398
|
call_args.map!(&:inspect)
|
399
399
|
call_args << parameters if parameters
|
400
400
|
|
@@ -36,7 +36,9 @@ module ActiveModel
|
|
36
36
|
#
|
37
37
|
# gem 'bcrypt', '~> 3.1.7'
|
38
38
|
#
|
39
|
-
#
|
39
|
+
# ==== Examples
|
40
|
+
#
|
41
|
+
# ===== Using Active Record (which automatically includes ActiveModel::SecurePassword)
|
40
42
|
#
|
41
43
|
# # Schema: User(name:string, password_digest:string, recovery_password_digest:string)
|
42
44
|
# class User < ActiveRecord::Base
|
@@ -58,6 +60,27 @@ module ActiveModel
|
|
58
60
|
# user.authenticate_recovery_password('42password') # => user
|
59
61
|
# User.find_by(name: 'david')&.authenticate('notright') # => false
|
60
62
|
# User.find_by(name: 'david')&.authenticate('mUc3m00RsqyRe') # => user
|
63
|
+
#
|
64
|
+
# ===== Conditionally requiring a password
|
65
|
+
#
|
66
|
+
# class Account
|
67
|
+
# include ActiveModel::SecurePassword
|
68
|
+
#
|
69
|
+
# attr_accessor :is_guest, :password_digest
|
70
|
+
#
|
71
|
+
# has_secure_password
|
72
|
+
#
|
73
|
+
# def errors
|
74
|
+
# super.tap { |errors| errors.delete(:password, :blank) if is_guest }
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# account = Account.new
|
79
|
+
# account.valid? # => false, password required
|
80
|
+
#
|
81
|
+
# account.is_guest = true
|
82
|
+
# account.valid? # => true
|
83
|
+
#
|
61
84
|
def has_secure_password(attribute = :password, validations: true)
|
62
85
|
# Load bcrypt gem only when has_secure_password is used.
|
63
86
|
# This is to avoid ActiveModel (and by extension the entire framework)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.
|
19
|
+
version: 7.0.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.0.
|
26
|
+
version: 7.0.4
|
27
27
|
description: A toolkit for building modeling frameworks like Active Record. Rich support
|
28
28
|
for attributes, callbacks, validations, serialization, internationalization, and
|
29
29
|
testing.
|
@@ -107,10 +107,10 @@ licenses:
|
|
107
107
|
- MIT
|
108
108
|
metadata:
|
109
109
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
110
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.
|
111
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.
|
110
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.4/activemodel/CHANGELOG.md
|
111
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.4/
|
112
112
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
113
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.
|
113
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.4/activemodel
|
114
114
|
rubygems_mfa_required: 'true'
|
115
115
|
post_install_message:
|
116
116
|
rdoc_options: []
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.3.
|
130
|
+
rubygems_version: 3.3.3
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: A toolkit for building modeling frameworks (part of Rails).
|