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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/active_model/attribute.rb +1 -1
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/translation.rb +14 -3
- data/lib/active_model/type/float.rb +8 -8
- data/lib/active_model/type/value.rb +1 -1
- data/lib/active_model/validations/acceptance.rb +1 -1
- metadata +8 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f47ebb694713a685204514dc5d04de997ca6949db638f45b354338698d650987
|
4
|
+
data.tar.gz: 4183f64d69034c0cf755de5055ebae00308bc6b6c6d42c314f97356a9b906615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfcb46dc147048dc714eadaa2b3389fac0b17294db99fd5aa7b29f37c7c3fdcc6cf5c3fdf472379bd00fc52a2c99bd9d6fe83d8abb5967e0f50a656959bd325d
|
7
|
+
data.tar.gz: 99e6c0227a8e467a578e9c9e8e3c59cd4854550ebb549d57c3dea0bf517f2a87200f5d0c426fb076fb7946d83cf8a8b233662792e5711388305b204c8cd5013e
|
data/CHANGELOG.md
CHANGED
@@ -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}
|
64
|
+
:"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}#{separator}#{key}"
|
57
65
|
end
|
58
|
-
defaults << :"#{i18n_scope}.attributes.#{
|
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
|
-
|
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
|
|
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.
|
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:
|
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.
|
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.
|
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.
|
116
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.
|
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.
|
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.
|
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: []
|