activemodel 7.0.3.1 → 7.0.4.1

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: 3983f4103ac1a1d31700ef6fb4bfb07f27385b0b31a24b37f4d5a15acfb01cb6
4
+ data.tar.gz: e3e9c49fccdbf7612c5fed0e4f1f8398e78580f186278061bf13686b3641be1c
5
5
  SHA512:
6
- metadata.gz: 4f23d0bc2105d523983d1b72915adf3ff5ec3cd7bbd690bb15c51bfb048d6b2f14c4e5760ca3a0eaae409be1ac5c643411d5a60ada8812d8116ae16d540ca249
7
- data.tar.gz: bfa2d89dc9f7674eeb49112b427bebd8e1d72f5f316b7103905f426ebf7c4901c9682db5c7851d495b88721182e71a9c4b4ec6898a352fb253fcd4d2c1dbbe3b
6
+ metadata.gz: ace33926f583026d7440b29c31bf0ed10997f72a1c658e74c0412a919c24fe2412d5afc0247a9c90c9bfe119d1a27934e6281aceeda4727f999a2c9aec8b728b
7
+ data.tar.gz: fbb3847d966bcf6ecc90facea967d883517759095abe55336d457da72c392103f174fb2b0818e0685ba21755b22017a8b4bc2a06a138fdc4c670989de25abba1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## Rails 7.0.4.1 (January 17, 2023) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 7.0.4 (September 09, 2022) ##
7
+
8
+ * Handle name clashes in attribute methods code generation cache.
9
+
10
+ When two distinct attribute methods would generate similar names,
11
+ the first implementation would be incorrectly re-used.
12
+
13
+ ```ruby
14
+ class A
15
+ attribute_method_suffix "_changed?"
16
+ define_attribute_methods :x
17
+ end
18
+
19
+ class B
20
+ attribute_method_suffix "?"
21
+ define_attribute_methods :x_changed
22
+ end
23
+ ```
24
+
25
+ *Jean Boussier*
26
+
1
27
  ## Rails 7.0.3.1 (July 12, 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 = "1"
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.1
4
+ version: 7.0.4.1
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: 2023-01-17 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.1
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.1
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.1/activemodel/CHANGELOG.md
111
+ documentation_uri: https://api.rubyonrails.org/v7.0.4.1/
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.1/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.3
130
+ rubygems_version: 3.4.3
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: A toolkit for building modeling frameworks (part of Rails).