activemodel 5.1.4 → 5.1.7
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 176c2e4b4046605da54dbff663e8cca4e615bf2f985f11ce19befb86dd54b6e5
|
4
|
+
data.tar.gz: f94d4e883f254dc43a58abe127653920a852ceb437d2e96163418b3c9f64b273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2571ca4fd35c99bbf91349f87a261a5e4821f8d2ec9172303c1d85536111ce843305bea423b3794e22a800270b9db8e9f97a23d981ab95ebda973547e8b0ad74
|
7
|
+
data.tar.gz: ce929044a81485baad038cfa449ee198720ed326afcb0aa3a782da558c7c4569e7f9ee433043fb5f48ddbbdfb26df75d376f2e1e256da13e80a4350126b06722
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## Rails 5.1.7 (March 27, 2019) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 5.1.6.2 (March 11, 2019) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 5.1.6.1 (November 27, 2018) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 5.1.6 (March 29, 2018) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 5.1.5 (February 14, 2018) ##
|
22
|
+
|
23
|
+
* Fix to working before/after validation callbacks on multiple contexts.
|
24
|
+
|
25
|
+
*Yoshiyuki Hirano*
|
26
|
+
|
1
27
|
## Rails 5.1.4 (September 07, 2017) ##
|
2
28
|
|
3
29
|
* No changes.
|
@@ -16,6 +16,8 @@ module ActiveModel
|
|
16
16
|
case value
|
17
17
|
when ::String
|
18
18
|
value = "2000-01-01 #{value}"
|
19
|
+
time_hash = ::Date._parse(value)
|
20
|
+
return if time_hash[:hour].nil?
|
19
21
|
when ::Time
|
20
22
|
value = value.change(year: 2000, day: 1, month: 1)
|
21
23
|
end
|
@@ -26,14 +28,10 @@ module ActiveModel
|
|
26
28
|
private
|
27
29
|
|
28
30
|
def cast_value(value)
|
29
|
-
return value unless value.is_a?(::String)
|
31
|
+
return apply_seconds_precision(value) unless value.is_a?(::String)
|
30
32
|
return if value.empty?
|
31
33
|
|
32
|
-
|
33
|
-
dummy_time_value = value
|
34
|
-
else
|
35
|
-
dummy_time_value = "2000-01-01 #{value}"
|
36
|
-
end
|
34
|
+
dummy_time_value = value.sub(/\A(\d\d\d\d-\d\d-\d\d |)/, "2000-01-01 ")
|
37
35
|
|
38
36
|
fast_string_to_time(dummy_time_value) || begin
|
39
37
|
time_hash = ::Date._parse(dummy_time_value)
|
@@ -52,14 +52,16 @@ module ActiveModel
|
|
52
52
|
# person.valid? # => true
|
53
53
|
# person.name # => "bob"
|
54
54
|
def before_validation(*args, &block)
|
55
|
-
options = args.
|
56
|
-
if
|
57
|
-
|
58
|
-
|
55
|
+
options = args.extract_options!
|
56
|
+
options[:if] = Array(options[:if])
|
57
|
+
|
58
|
+
if options.key?(:on)
|
59
59
|
options[:if].unshift ->(o) {
|
60
|
-
options[:on]
|
60
|
+
!(Array(options[:on]) & Array(o.validation_context)).empty?
|
61
61
|
}
|
62
62
|
end
|
63
|
+
|
64
|
+
args << options
|
63
65
|
set_callback(:validation, :before, *args, &block)
|
64
66
|
end
|
65
67
|
|
@@ -93,13 +95,15 @@ module ActiveModel
|
|
93
95
|
options = args.extract_options!
|
94
96
|
options[:prepend] = true
|
95
97
|
options[:if] = Array(options[:if])
|
96
|
-
|
97
|
-
|
98
|
+
|
99
|
+
if options.key?(:on)
|
98
100
|
options[:if].unshift ->(o) {
|
99
|
-
options[:on]
|
101
|
+
!(Array(options[:on]) & Array(o.validation_context)).empty?
|
100
102
|
}
|
101
103
|
end
|
102
|
-
|
104
|
+
|
105
|
+
args << options
|
106
|
+
set_callback(:validation, :after, *args, &block)
|
103
107
|
end
|
104
108
|
end
|
105
109
|
|
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: 5.1.
|
4
|
+
version: 5.1.7
|
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:
|
11
|
+
date: 2019-03-28 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: 5.1.
|
19
|
+
version: 5.1.7
|
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: 5.1.
|
26
|
+
version: 5.1.7
|
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.
|
@@ -92,7 +92,9 @@ files:
|
|
92
92
|
homepage: http://rubyonrails.org
|
93
93
|
licenses:
|
94
94
|
- MIT
|
95
|
-
metadata:
|
95
|
+
metadata:
|
96
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.1.7/activemodel
|
97
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.1.7/activemodel/CHANGELOG.md
|
96
98
|
post_install_message:
|
97
99
|
rdoc_options: []
|
98
100
|
require_paths:
|
@@ -108,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
110
|
- !ruby/object:Gem::Version
|
109
111
|
version: '0'
|
110
112
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.6.13
|
113
|
+
rubygems_version: 3.0.1
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: A toolkit for building modeling frameworks (part of Rails).
|