activemodel 6.1.1 → 6.1.3.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 +25 -0
- data/README.rdoc +1 -1
- data/lib/active_model/attribute.rb +4 -4
- data/lib/active_model/error.rb +3 -3
- data/lib/active_model/errors.rb +1 -1
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/validations/numericality.rb +7 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a034b96ff75ba8ae7e6eb49d54d5d9c03a369f5a64519b1ab79807cb15ba1a44
|
4
|
+
data.tar.gz: 72c9f8d4309b1f71631cbaafef722776fb57e6e2347a95418ed05b9a5f6048d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d37f4e2302fcee562071a4f1007ee312bf31a4e581872a39c6b2cfbd8dcb81f544591cc789d262910486bfcb75c6c8218ea538b9c6f7bafcdeef3c2b5944750
|
7
|
+
data.tar.gz: a3c6c93d6e26167a6779c5b7f5cc3141e2942f0f89c1bd3c02c0db3a9d8ff21bac98fde5145e6e516f2de30eb02ff709ef7b6405bf5b08015e2d6cea49f21e76
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
22
|
+
|
23
|
+
* No changes.
|
24
|
+
|
25
|
+
|
1
26
|
## Rails 6.1.1 (January 07, 2021) ##
|
2
27
|
|
3
28
|
* No changes.
|
data/README.rdoc
CHANGED
@@ -241,7 +241,7 @@ The latest version of Active Model can be installed with RubyGems:
|
|
241
241
|
|
242
242
|
Source code can be downloaded as part of the Rails project on GitHub
|
243
243
|
|
244
|
-
* https://github.com/rails/rails/tree/
|
244
|
+
* https://github.com/rails/rails/tree/main/activemodel
|
245
245
|
|
246
246
|
|
247
247
|
== License
|
@@ -164,10 +164,10 @@ module ActiveModel
|
|
164
164
|
type.deserialize(value)
|
165
165
|
end
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
private
|
168
|
+
def _original_value_for_database
|
169
|
+
value_before_type_cast
|
170
|
+
end
|
171
171
|
end
|
172
172
|
|
173
173
|
class FromUser < Attribute # :nodoc:
|
data/lib/active_model/error.rb
CHANGED
@@ -119,11 +119,11 @@ module ActiveModel
|
|
119
119
|
attr_reader :base
|
120
120
|
# The attribute of +base+ which the error belongs to
|
121
121
|
attr_reader :attribute
|
122
|
-
# The type of error, defaults to
|
122
|
+
# The type of error, defaults to +:invalid+ unless specified
|
123
123
|
attr_reader :type
|
124
|
-
# The raw value provided as the second parameter when calling
|
124
|
+
# The raw value provided as the second parameter when calling +errors#add+
|
125
125
|
attr_reader :raw_type
|
126
|
-
# The options provided when calling
|
126
|
+
# The options provided when calling +errors#add+
|
127
127
|
attr_reader :options
|
128
128
|
|
129
129
|
# Returns the error message.
|
data/lib/active_model/errors.rb
CHANGED
@@ -110,7 +110,7 @@ module ActiveModel
|
|
110
110
|
# Imports one error
|
111
111
|
# Imported errors are wrapped as a NestedError,
|
112
112
|
# providing access to original error object.
|
113
|
-
# If attribute or type needs to be overridden, use
|
113
|
+
# If attribute or type needs to be overridden, use +override_options+.
|
114
114
|
#
|
115
115
|
# override_options - Hash
|
116
116
|
# @option override_options [Symbol] :attribute Override the attribute the error belongs to
|
@@ -64,6 +64,8 @@ module ActiveModel
|
|
64
64
|
def parse_as_number(raw_value, precision, scale)
|
65
65
|
if raw_value.is_a?(Float)
|
66
66
|
parse_float(raw_value, precision, scale)
|
67
|
+
elsif raw_value.is_a?(BigDecimal)
|
68
|
+
round(raw_value, scale)
|
67
69
|
elsif raw_value.is_a?(Numeric)
|
68
70
|
raw_value
|
69
71
|
elsif is_integer?(raw_value)
|
@@ -74,7 +76,11 @@ module ActiveModel
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def parse_float(raw_value, precision, scale)
|
77
|
-
(
|
79
|
+
round(raw_value, scale).to_d(precision)
|
80
|
+
end
|
81
|
+
|
82
|
+
def round(raw_value, scale)
|
83
|
+
scale ? raw_value.round(scale) : raw_value
|
78
84
|
end
|
79
85
|
|
80
86
|
def is_number?(raw_value, precision, scale)
|
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: 6.1.
|
4
|
+
version: 6.1.3.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: 2021-
|
11
|
+
date: 2021-05-05 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: 6.1.
|
19
|
+
version: 6.1.3.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: 6.1.
|
26
|
+
version: 6.1.3.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.
|
@@ -104,10 +104,10 @@ licenses:
|
|
104
104
|
- MIT
|
105
105
|
metadata:
|
106
106
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
107
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.1.
|
108
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.
|
107
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.3.2/activemodel/CHANGELOG.md
|
108
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.3.2/
|
109
109
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
110
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.
|
110
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.3.2/activemodel
|
111
111
|
post_install_message:
|
112
112
|
rdoc_options: []
|
113
113
|
require_paths:
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.2
|
126
|
+
rubygems_version: 3.1.2
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: A toolkit for building modeling frameworks (part of Rails).
|