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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6250491aa5f3d24fa77846ca094c19689c40f71b703fcab251132c531b8274e8
4
- data.tar.gz: 581eda30602331e3cfb498944019a6c40feddd8f0bdb5334786c2f150f8a116b
3
+ metadata.gz: 630260cc44166916794fb7e43002e72a303ff43b834e82e530cff1f13f25ee7f
4
+ data.tar.gz: f136cec57987c03ab4aa3fba2b65fe2964b010a326e28cdc0d32f755b45612f1
5
5
  SHA512:
6
- metadata.gz: 18cc738cc1dcb451541b2303a0998d7cc23be8703eeac875b74a4fdb950d28d8a083aff7a962e05d615e8df2f4914ff63859f6868ba61e1ba46217202702bc0f
7
- data.tar.gz: fdc4df18243ee13da9ec2659244cf022923e93cddba27f046e0ac3b2e60e078b163256b50db68fa1725e228a3a355135cda92ef255dc5d8034fcc1623b38daae
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
 
@@ -9,7 +9,7 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 3
12
+ TINY = 4
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -36,7 +36,9 @@ module ActiveModel
36
36
  #
37
37
  # gem 'bcrypt', '~> 3.1.7'
38
38
  #
39
- # Example using Active Record (which automatically includes ActiveModel::SecurePassword):
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.3
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-05-09 00:00:00.000000000 Z
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.3
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.3
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.3/activemodel/CHANGELOG.md
111
- documentation_uri: https://api.rubyonrails.org/v7.0.3/
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.3/activemodel
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.7
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).