activemodel 5.2.0 → 5.2.1.rc1
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 +5 -0
- data/lib/active_model/attribute_mutation_tracker.rb +9 -1
- data/lib/active_model/errors.rb +1 -1
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/type/boolean.rb +4 -0
- data/lib/active_model/type/helpers/time_value.rb +1 -0
- data/lib/active_model/type/time.rb +2 -0
- data/lib/active_model/type/value.rb +4 -0
- data/lib/active_model/validations/numericality.rb +4 -2
- 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: 8b824abe75d547112f666ea244b01d9efdfe385b4307d01abc02029d417ce127
|
4
|
+
data.tar.gz: d091044bf9888873e9eafb7c872a921b3a8b0420fb29146c43f6fe54c0b667e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 538acb7c8f53bbd99d1d020e77a9696cc9b14970ffb2dc4f2ee07345c5118eb2f71a07c40cae6d640ffbc76577714591c06ad2e3afbcd093a9bbe1e1d8891b4f
|
7
|
+
data.tar.gz: 60bc4bb46c72b06361f397aae8c0d0b4d0615e35644ee3036822a79a96711887b1884aac14215128414d40015766639db7ac621b3236c9e62c3d467f50146f5c
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,10 @@ module ActiveModel
|
|
11
11
|
@forced_changes = Set.new
|
12
12
|
end
|
13
13
|
|
14
|
+
def changed_attribute_names
|
15
|
+
attr_names.select { |attr_name| changed?(attr_name) }
|
16
|
+
end
|
17
|
+
|
14
18
|
def changed_values
|
15
19
|
attr_names.each_with_object({}.with_indifferent_access) do |attr_name, result|
|
16
20
|
if changed?(attr_name)
|
@@ -23,7 +27,7 @@ module ActiveModel
|
|
23
27
|
attr_names.each_with_object({}.with_indifferent_access) do |attr_name, result|
|
24
28
|
change = change_to_attribute(attr_name)
|
25
29
|
if change
|
26
|
-
result
|
30
|
+
result.merge!(attr_name => change)
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -81,6 +85,10 @@ module ActiveModel
|
|
81
85
|
class NullMutationTracker # :nodoc:
|
82
86
|
include Singleton
|
83
87
|
|
88
|
+
def changed_attribute_names(*)
|
89
|
+
[]
|
90
|
+
end
|
91
|
+
|
84
92
|
def changed_values(*)
|
85
93
|
{}
|
86
94
|
end
|
data/lib/active_model/errors.rb
CHANGED
@@ -323,7 +323,7 @@ module ActiveModel
|
|
323
323
|
# person.errors.added? :name, "is too long" # => false
|
324
324
|
def added?(attribute, message = :invalid, options = {})
|
325
325
|
if message.is_a? Symbol
|
326
|
-
self.details[attribute].map { |e| e[:error] }.include? message
|
326
|
+
self.details[attribute.to_sym].map { |e| e[:error] }.include? message
|
327
327
|
else
|
328
328
|
message = message.call if message.respond_to?(:call)
|
329
329
|
message = normalize_message(attribute, message, options)
|
@@ -19,9 +19,11 @@ module ActiveModel
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def validate_each(record, attr_name, value)
|
22
|
-
|
22
|
+
came_from_user = :"#{attr_name}_came_from_user?"
|
23
23
|
|
24
|
-
|
24
|
+
if record.respond_to?(came_from_user) && record.public_send(came_from_user)
|
25
|
+
raw_value = record.read_attribute_before_type_cast(attr_name)
|
26
|
+
end
|
25
27
|
raw_value ||= value
|
26
28
|
|
27
29
|
if record_attribute_changed_in_place?(record, attr_name)
|
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.2.
|
4
|
+
version: 5.2.1.rc1
|
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: 2018-
|
11
|
+
date: 2018-07-30 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.2.
|
19
|
+
version: 5.2.1.rc1
|
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.2.
|
26
|
+
version: 5.2.1.rc1
|
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.
|
@@ -100,8 +100,8 @@ homepage: http://rubyonrails.org
|
|
100
100
|
licenses:
|
101
101
|
- MIT
|
102
102
|
metadata:
|
103
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.
|
104
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.
|
103
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.1.rc1/activemodel
|
104
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.1.rc1/activemodel/CHANGELOG.md
|
105
105
|
post_install_message:
|
106
106
|
rdoc_options: []
|
107
107
|
require_paths:
|
@@ -113,12 +113,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: 2.2.2
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - ">"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: 1.3.1
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.7.
|
121
|
+
rubygems_version: 2.7.3
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: A toolkit for building modeling frameworks (part of Rails).
|