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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 187907df332936988c9eba39330779ff89b1080e
4
- data.tar.gz: 7eca08dafdab89b326c0167ecfee8d5b7d487ded
3
+ metadata.gz: 3f7ad7a43ab3ab58ba5f7416d2ccf4f703022c69
4
+ data.tar.gz: 2c34cdd86def65c713490bae07845a11f042fd55
5
5
  SHA512:
6
- metadata.gz: 6dd164ef7b2f08b8b876bf9c4f94f3f24c01e67db30afefad7c7c56daa5411c8628ed36ce9c68ad26149d9c60c73dba542ba3164a12d72e3007991bda3240f0f
7
- data.tar.gz: 5c8e3f1e7662de8671191f6ff6c9cd347f53d4fcb4bdc7960790182c99d62a71becaf5a09ae4c4477cbb112f78ae63d6788033d8eadddcf710fdf5f21a9d3649
6
+ metadata.gz: 86c1a3cd564baa3947317fda7e795c0552fba747cabf4d3b49c4a6429d49dca2d8cc923b54eda49c540d79ca44a7e09bcf81054cc94d5b1b63998e8b98355c96
7
+ data.tar.gz: 192a19c563abce9f7a9dfcb9c169427bd4fe34be360d6fde5a6f14ea3efca44c85e95b1d177f60975296649b440eb7affd9c7a8e7d14d0b5040685ac7f2000e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Rails 5.0.0.rc2 (June 22, 2016) ##
2
+
3
+ * Ensure that instances of `ActiveModel::Errors` can be marshalled.
4
+ Fixes #25165.
5
+
6
+ *Sean Griffin*
7
+
1
8
  ## Rails 5.0.0.rc1 (May 06, 2016) ##
2
9
 
3
10
  * No changes.
@@ -71,8 +71,8 @@ module ActiveModel
71
71
  # end
72
72
  def initialize(base)
73
73
  @base = base
74
- @messages = Hash.new { |messages, attribute| messages[attribute] = [] }
75
- @details = Hash.new { |details, attribute| details[attribute] = [] }
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
@@ -8,7 +8,7 @@ module ActiveModel
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "rc1"
11
+ PRE = "rc2"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -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 fixnum and float columns empty strings are
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.rc1
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-05-06 00:00:00.000000000 Z
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.rc1
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.rc1
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.5.1
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).