activemodel 5.0.0.rc1 → 5.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/active_model/errors.rb +23 -2
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/validations/numericality.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f7ad7a43ab3ab58ba5f7416d2ccf4f703022c69
|
4
|
+
data.tar.gz: 2c34cdd86def65c713490bae07845a11f042fd55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c1a3cd564baa3947317fda7e795c0552fba747cabf4d3b49c4a6429d49dca2d8cc923b54eda49c540d79ca44a7e09bcf81054cc94d5b1b63998e8b98355c96
|
7
|
+
data.tar.gz: 192a19c563abce9f7a9dfcb9c169427bd4fe34be360d6fde5a6f14ea3efca44c85e95b1d177f60975296649b440eb7affd9c7a8e7d14d0b5040685ac7f2000e8
|
data/CHANGELOG.md
CHANGED
data/lib/active_model/errors.rb
CHANGED
@@ -71,8 +71,8 @@ module ActiveModel
|
|
71
71
|
# end
|
72
72
|
def initialize(base)
|
73
73
|
@base = base
|
74
|
-
@messages =
|
75
|
-
@details
|
74
|
+
@messages = apply_default_array({})
|
75
|
+
@details = apply_default_array({})
|
76
76
|
end
|
77
77
|
|
78
78
|
def initialize_dup(other) # :nodoc:
|
@@ -493,6 +493,16 @@ module ActiveModel
|
|
493
493
|
I18n.translate(key, options)
|
494
494
|
end
|
495
495
|
|
496
|
+
def marshal_dump
|
497
|
+
[@base, without_default_proc(@messages), without_default_proc(@details)]
|
498
|
+
end
|
499
|
+
|
500
|
+
def marshal_load(array)
|
501
|
+
@base, @messages, @details = array
|
502
|
+
apply_default_array(@messages)
|
503
|
+
apply_default_array(@details)
|
504
|
+
end
|
505
|
+
|
496
506
|
private
|
497
507
|
def normalize_message(attribute, message, options)
|
498
508
|
case message
|
@@ -506,6 +516,17 @@ module ActiveModel
|
|
506
516
|
def normalize_detail(message, options)
|
507
517
|
{ error: message }.merge(options.except(*CALLBACKS_OPTIONS + MESSAGE_OPTIONS))
|
508
518
|
end
|
519
|
+
|
520
|
+
def without_default_proc(hash)
|
521
|
+
hash.dup.tap do |new_h|
|
522
|
+
new_h.default_proc = nil
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
def apply_default_array(hash)
|
527
|
+
hash.default_proc = proc { |h, key| h[key] = [] }
|
528
|
+
hash
|
529
|
+
end
|
509
530
|
end
|
510
531
|
|
511
532
|
# Raised when a validation cannot be corrected by end users and are considered
|
@@ -120,7 +120,7 @@ module ActiveModel
|
|
120
120
|
# * <tt>:only_integer</tt> - Specifies whether the value has to be an
|
121
121
|
# integer, e.g. an integral value (default is +false+).
|
122
122
|
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+ (default is
|
123
|
-
# +false+). Notice that for
|
123
|
+
# +false+). Notice that for Integer and Float columns empty strings are
|
124
124
|
# converted to +nil+.
|
125
125
|
# * <tt>:greater_than</tt> - Specifies the value must be greater than the
|
126
126
|
# supplied value.
|
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.0.0.
|
4
|
+
version: 5.0.0.rc2
|
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: 2016-
|
11
|
+
date: 2016-06-22 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.0.0.
|
19
|
+
version: 5.0.0.rc2
|
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.0.0.
|
26
|
+
version: 5.0.0.rc2
|
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.
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: 1.3.1
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.6.4
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A toolkit for building modeling frameworks (part of Rails).
|