activemodel 7.0.3.1 → 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: 2845eb500d658cf1e666a48cbba3e2e96894a92cec97a1dfaff8cf4883f3909a
4
- data.tar.gz: 0c6f8b7de47368da12af30e2c0a03c7b0022ae08a40a316a018899481801804c
3
+ metadata.gz: 630260cc44166916794fb7e43002e72a303ff43b834e82e530cff1f13f25ee7f
4
+ data.tar.gz: f136cec57987c03ab4aa3fba2b65fe2964b010a326e28cdc0d32f755b45612f1
5
5
  SHA512:
6
- metadata.gz: 4f23d0bc2105d523983d1b72915adf3ff5ec3cd7bbd690bb15c51bfb048d6b2f14c4e5760ca3a0eaae409be1ac5c643411d5a60ada8812d8116ae16d540ca249
7
- data.tar.gz: bfa2d89dc9f7674eeb49112b427bebd8e1d72f5f316b7103905f426ebf7c4901c9682db5c7851d495b88721182e71a9c4b4ec6898a352fb253fcd4d2c1dbbe3b
6
+ metadata.gz: 9b16a3dd6f96bf2ec1bfa5e3abba2e513567b12035e34e8ea30c24fb8a08ca70089d394f5daa0f40fdc4e14fb63470593904a5a335f864782983c719cf0d57d2
7
+ data.tar.gz: 66f3f86fcf4b90ffbab8ea82777ac2df48f1774f7ff528d44ec81e12ea47cb2050309b5535e9e960757eb8f9350efa9c6a128754c3b117fdedef3e3c42a43765
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
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
+
1
22
  ## Rails 7.0.3.1 (July 12, 2022) ##
2
23
 
3
24
  * 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,8 +9,8 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 3
13
- PRE = "1"
12
+ TINY = 4
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -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.1
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-07-12 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.1
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.1
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.1/activemodel/CHANGELOG.md
111
- documentation_uri: https://api.rubyonrails.org/v7.0.3.1/
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.1/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: []