activemodel 6.1.0.rc2 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -6
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/validations/numericality.rb +3 -3
- data/lib/active_model/validator.rb +4 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1caa114ce8c604cb9ac388ef4ebbfd796f8ff253799322db9fa714193bca6821
|
4
|
+
data.tar.gz: 49f8fb7f47a3154022161dee9871d6aba46f7750b3381e690e37d7ff2663ef48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26271099e8c36f89e1ee19fcb3469be914240ea887f15aba4d0de79b3db57f17d8467f523010330ba4f70e4df01d14398a6db7687df0a9be674f17ffd284be5d
|
7
|
+
data.tar.gz: e32d32dac693b8cae0445b2b9634345688b4010ecd4cbda054288934b4d0aeb353486415b55934e2c298fc8ab09655712ede1214e175ef4b67fe8af80926bb86
|
data/CHANGELOG.md
CHANGED
@@ -108,8 +108,8 @@ module ActiveModel
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def
|
112
|
-
return
|
111
|
+
def prepare_value_for_validation(value, record, attr_name)
|
112
|
+
return value if record_attribute_changed_in_place?(record, attr_name)
|
113
113
|
|
114
114
|
came_from_user = :"#{attr_name}_came_from_user?"
|
115
115
|
|
@@ -126,7 +126,7 @@ module ActiveModel
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
raw_value ||
|
129
|
+
raw_value || value
|
130
130
|
end
|
131
131
|
|
132
132
|
def record_attribute_changed_in_place?(record, attr_name)
|
@@ -147,8 +147,9 @@ module ActiveModel
|
|
147
147
|
# override +validate_each+ with validation logic.
|
148
148
|
def validate(record)
|
149
149
|
attributes.each do |attribute|
|
150
|
-
value = read_attribute_for_validation(
|
150
|
+
value = record.read_attribute_for_validation(attribute)
|
151
151
|
next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])
|
152
|
+
value = prepare_value_for_validation(value, record, attribute)
|
152
153
|
validate_each(record, attribute, value)
|
153
154
|
end
|
154
155
|
end
|
@@ -166,8 +167,8 @@ module ActiveModel
|
|
166
167
|
end
|
167
168
|
|
168
169
|
private
|
169
|
-
def
|
170
|
-
|
170
|
+
def prepare_value_for_validation(value, record, attr_name)
|
171
|
+
value
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
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.0
|
4
|
+
version: 6.1.0
|
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: 2020-12-
|
11
|
+
date: 2020-12-09 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.0
|
19
|
+
version: 6.1.0
|
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.0
|
26
|
+
version: 6.1.0
|
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.0
|
108
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.0
|
107
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.0/activemodel/CHANGELOG.md
|
108
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.0/
|
109
109
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
110
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.0
|
110
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.0/activemodel
|
111
111
|
post_install_message:
|
112
112
|
rdoc_options: []
|
113
113
|
require_paths:
|
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: 2.5.0
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubygems_version: 3.1.4
|
127
127
|
signing_key:
|