activemodel 7.2.1.2 → 7.2.2

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: 5f15df1a8704856788191a6dd2ff7a4dcbfc97bc39f1010fc10291f00b4f8541
4
- data.tar.gz: 7bb664e8f4b317d7524a3fce9ecfa9050e26e52abb5f145be7da30a447250ffe
3
+ metadata.gz: '083ab781edd077dd1864bceb8ad069bde3954eaa020c84dddf2cd6c74490ab6a'
4
+ data.tar.gz: dd7682a299773c0d0e07b43d662ec98cefca8922eeca8ba6fe80856296c32f03
5
5
  SHA512:
6
- metadata.gz: 14ed78c9526acc0f729488c0005926c11d30a4a25144d234d3c15e63b9021e68618646cdd4fc7e1729dfe2ec669bd6da65c602946e582d6b88799368d53eb920
7
- data.tar.gz: fcfcdf7ad2cdb6ba0dd9c72774023fddbcfa863da95d2bb77e4b98977d2943b487814e2f91253da840238addcc216f1a4f5bbcdb728a8fdc2b61d0169e656d58
6
+ metadata.gz: cb3a9de619551c4a7685880566cbd1a8c3f230d8669980037d54611912e41772679f894625e6947ab5abeed2e974bc07cc03addbb99907ebed1927ee08d8cee2
7
+ data.tar.gz: 8c723612cdf1701f67977db5f8b2634c3e5e836a1c9bb6542bfba8b459b3ccb4762db96e9854be993a947f4b946a89a4f4f2e82d493f20672ed9494db0d980c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## Rails 7.2.2 (October 30, 2024) ##
2
+
3
+ * Fix regression in `alias_attribute` to work with user defined methods.
4
+
5
+ `alias_attribute` would wrongly assume the attribute accessor was generated by Active Model.
6
+
7
+ ```ruby
8
+ class Person
9
+ include ActiveModel::AttributeMethods
10
+
11
+ define_attribute_methods :name
12
+ attr_accessor :name
13
+
14
+ alias_attribute :full_name, :name
15
+ end
16
+
17
+ person.full_name # => NoMethodError: undefined method `attribute' for an instance of Person
18
+ ```
19
+
20
+ *Jean Boussier*
21
+
22
+
1
23
  ## Rails 7.2.1.2 (October 23, 2024) ##
2
24
 
3
25
  * No changes.
@@ -215,7 +215,12 @@ module ActiveModel
215
215
  end
216
216
 
217
217
  def generate_alias_attribute_methods(code_generator, new_name, old_name)
218
- define_attribute_method(old_name, _owner: code_generator, as: new_name)
218
+ ActiveSupport::CodeGenerator.batch(code_generator, __FILE__, __LINE__) do |owner|
219
+ attribute_method_patterns.each do |pattern|
220
+ alias_attribute_method_definition(code_generator, pattern, new_name, old_name)
221
+ end
222
+ attribute_method_patterns_cache.clear
223
+ end
219
224
  end
220
225
 
221
226
  def alias_attribute_method_definition(code_generator, pattern, new_name, old_name) # :nodoc:
@@ -228,7 +233,7 @@ module ActiveModel
228
233
  call_args = []
229
234
  call_args << parameters if parameters
230
235
 
231
- define_call(code_generator, method_name, target_name, mangled_name, parameters, call_args, namespace: :alias_attribute)
236
+ define_call(code_generator, method_name, target_name, mangled_name, parameters, call_args, namespace: :alias_attribute, as: method_name)
232
237
  end
233
238
 
234
239
  # Is +new_name+ an alias?
@@ -441,7 +446,7 @@ module ActiveModel
441
446
  mangled_name = name
442
447
 
443
448
  unless NAME_COMPILABLE_REGEXP.match?(name)
444
- mangled_name = "__temp__#{name.unpack1("h*")}"
449
+ mangled_name = :"__temp__#{name.unpack1("h*")}"
445
450
  end
446
451
 
447
452
  mangled_name
@@ -9,8 +9,8 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 2
12
- TINY = 1
13
- PRE = "2"
12
+ TINY = 2
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
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.2.1.2
4
+ version: 7.2.2
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: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2024-10-31 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.2.1.2
19
+ version: 7.2.2
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.2.1.2
26
+ version: 7.2.2
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.
@@ -112,10 +112,10 @@ licenses:
112
112
  - MIT
113
113
  metadata:
114
114
  bug_tracker_uri: https://github.com/rails/rails/issues
115
- changelog_uri: https://github.com/rails/rails/blob/v7.2.1.2/activemodel/CHANGELOG.md
116
- documentation_uri: https://api.rubyonrails.org/v7.2.1.2/
115
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.2/activemodel/CHANGELOG.md
116
+ documentation_uri: https://api.rubyonrails.org/v7.2.2/
117
117
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
118
- source_code_uri: https://github.com/rails/rails/tree/v7.2.1.2/activemodel
118
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.2/activemodel
119
119
  rubygems_mfa_required: 'true'
120
120
  post_install_message:
121
121
  rdoc_options: []