activemodel 8.0.1 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82c77cf956bb596f9c8b1f54759653d6c89277953f1d4f65cfa0719b4805f7fd
4
- data.tar.gz: 0a90fee096e7ba10c38382a0773ddc9ba2fbc115f0313442d907243544c03d0f
3
+ metadata.gz: f47ebb694713a685204514dc5d04de997ca6949db638f45b354338698d650987
4
+ data.tar.gz: 4183f64d69034c0cf755de5055ebae00308bc6b6c6d42c314f97356a9b906615
5
5
  SHA512:
6
- metadata.gz: abe56d4420b361ac304800b16f9e1c54f8a03e89a27be8341cea8f4b6b29dce30ae88d4a52f9c65944eb31330f70b779b4dcdd9b0812797382f935c5727b6461
7
- data.tar.gz: aafdd1de1caf910aa090ecd82fad83c106a2b31f500a9884c7668e7aca2c4d89dd9a87e8404b12c26b825b0f4e91c74e6f6fee2473d41c967e78b11f44e8441a
6
+ metadata.gz: bfcb46dc147048dc714eadaa2b3389fac0b17294db99fd5aa7b29f37c7c3fdcc6cf5c3fdf472379bd00fc52a2c99bd9d6fe83d8abb5967e0f50a656959bd325d
7
+ data.tar.gz: 99e6c0227a8e467a578e9c9e8e3c59cd4854550ebb549d57c3dea0bf517f2a87200f5d0c426fb076fb7946d83cf8a8b233662792e5711388305b204c8cd5013e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## Rails 8.0.2 (March 12, 2025) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 8.0.2 (March 12, 2025) ##
7
+
8
+ * No changes.
9
+
10
+
1
11
  ## Rails 8.0.1 (December 13, 2024) ##
2
12
 
3
13
  * No changes.
@@ -38,7 +38,7 @@ module ActiveModel
38
38
  @value = value unless value.nil?
39
39
  end
40
40
 
41
- def value
41
+ def value(&_)
42
42
  # `defined?` is cheaper than `||=` when we get back falsy values
43
43
  @value = type_cast(value_before_type_cast) unless defined?(@value)
44
44
  @value
@@ -9,7 +9,7 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -52,10 +52,19 @@ module ActiveModel
52
52
  namespace, _, attribute = attribute.rpartition(".")
53
53
  namespace.tr!(".", "/")
54
54
 
55
+ if attribute.present?
56
+ key = "#{namespace}.#{attribute}"
57
+ separator = "/"
58
+ else
59
+ key = namespace
60
+ separator = "."
61
+ end
62
+
55
63
  defaults = lookup_ancestors.map do |klass|
56
- :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}/#{namespace}.#{attribute}"
64
+ :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}#{separator}#{key}"
57
65
  end
58
- defaults << :"#{i18n_scope}.attributes.#{namespace}.#{attribute}"
66
+ defaults << :"#{i18n_scope}.attributes.#{key}"
67
+ defaults << :"attributes.#{key}"
59
68
  else
60
69
  defaults = lookup_ancestors.map do |klass|
61
70
  :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}"
@@ -69,7 +78,9 @@ module ActiveModel
69
78
  defaults << MISSING_TRANSLATION unless raise_on_missing
70
79
 
71
80
  translation = I18n.translate(defaults.shift, count: 1, raise: raise_on_missing, **options, default: defaults)
72
- translation = attribute.humanize if translation == MISSING_TRANSLATION
81
+ if translation == MISSING_TRANSLATION
82
+ translation = attribute.present? ? attribute.humanize : namespace.humanize
83
+ end
73
84
  translation
74
85
  end
75
86
  end
@@ -15,14 +15,6 @@ module ActiveModel
15
15
  # attribute :weight, :float
16
16
  # end
17
17
  #
18
- # Values are cast using their +to_f+ method, except for the following
19
- # strings:
20
- #
21
- # - Blank strings are cast to +nil+.
22
- # - <tt>"Infinity"</tt> is cast to +Float::INFINITY+.
23
- # - <tt>"-Infinity"</tt> is cast to <tt>-Float::INFINITY</tt>.
24
- # - <tt>"NaN"</tt> is cast to +Float::NAN+.
25
- #
26
18
  # bag = BagOfCoffee.new
27
19
  #
28
20
  # bag.weight = "0.25"
@@ -33,6 +25,14 @@ module ActiveModel
33
25
  #
34
26
  # bag.weight = "NaN"
35
27
  # bag.weight # => Float::NAN
28
+ #
29
+ # Values are cast using their +to_f+ method, except for the following
30
+ # strings:
31
+ #
32
+ # - Blank strings are cast to +nil+.
33
+ # - <tt>"Infinity"</tt> is cast to +Float::INFINITY+.
34
+ # - <tt>"-Infinity"</tt> is cast to <tt>-Float::INFINITY</tt>.
35
+ # - <tt>"NaN"</tt> is cast to +Float::NAN+.
36
36
  class Float < Value
37
37
  include Helpers::Numeric
38
38
 
@@ -25,7 +25,7 @@ module ActiveModel
25
25
  # by the database. For example a boolean type can return +true+ if the
26
26
  # value parameter is a Ruby boolean, but may return +false+ if the value
27
27
  # parameter is some other object.
28
- def serializable?(value)
28
+ def serializable?(value, &_)
29
29
  true
30
30
  end
31
31
 
@@ -24,7 +24,7 @@ module ActiveModel
24
24
  Array(options[:accept]).include?(value)
25
25
  end
26
26
 
27
- class LazilyDefineAttributes < Module
27
+ class LazilyDefineAttributes < Module # :nodoc:
28
28
  def initialize(attributes)
29
29
  @attributes = attributes.map(&:to_s)
30
30
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
10
+ date: 2025-03-12 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 8.0.1
18
+ version: 8.0.2
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 8.0.1
25
+ version: 8.0.2
27
26
  description: A toolkit for building modeling frameworks like Active Record. Rich support
28
27
  for attributes, callbacks, validations, serialization, internationalization, and
29
28
  testing.
@@ -112,12 +111,11 @@ licenses:
112
111
  - MIT
113
112
  metadata:
114
113
  bug_tracker_uri: https://github.com/rails/rails/issues
115
- changelog_uri: https://github.com/rails/rails/blob/v8.0.1/activemodel/CHANGELOG.md
116
- documentation_uri: https://api.rubyonrails.org/v8.0.1/
114
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.2/activemodel/CHANGELOG.md
115
+ documentation_uri: https://api.rubyonrails.org/v8.0.2/
117
116
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
118
- source_code_uri: https://github.com/rails/rails/tree/v8.0.1/activemodel
117
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.2/activemodel
119
118
  rubygems_mfa_required: 'true'
120
- post_install_message:
121
119
  rdoc_options: []
122
120
  require_paths:
123
121
  - lib
@@ -132,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  requirements: []
135
- rubygems_version: 3.5.22
136
- signing_key:
133
+ rubygems_version: 3.6.2
137
134
  specification_version: 4
138
135
  summary: A toolkit for building modeling frameworks (part of Rails).
139
136
  test_files: []