active_model-errors_details 1.3.0 → 1.3.1

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: 3dff9bf03484706f8055dba610aa63a39098c00f
4
- data.tar.gz: c53ce253b6ea7f322f5e21f4308fe90e170b1a08
3
+ metadata.gz: f56ffab187151f1ff99c1fe0a547b280a687d232
4
+ data.tar.gz: 33d1d2aadf3104a37856c6bc9846f8baddc70ae7
5
5
  SHA512:
6
- metadata.gz: 6335f01847ac63a228d66373e1c06906291b377f1bc260ccd37c51489038cfa4f031a45d28d72a32820e6ddbcea622fa96bda832f289c47c1a4d43ce19a0ad00
7
- data.tar.gz: 4ffc69ec8985f4247d0b9c108e681578d1eb52be5ea6cdf85394fd30252151a403e84f8ea6f26fd5bf6036d5b17564116495b9cf0467e9b645e41e80c2c80a2e
6
+ metadata.gz: 381c975e277fead0f48cb1d0c208154d29169b07609f0c103ffb9b1bdd846f1bd20952d41ea69f7569661745863dd931a68756207eb067e38e0908f9bc215cab
7
+ data.tar.gz: 5e803b96cc3c8229eaced516ecf6631fff3140c311f3c9b60fb5212c4c5ffc0a9e3d47b5ab5d8cb9734e3e9a5337b21fca0ea39d5ef82ea1d9d6ffcc9f7065cb
@@ -6,4 +6,4 @@ notifications:
6
6
  rvm:
7
7
  - 2.0
8
8
  - 2.2
9
- - 2.3
9
+ - 2.3.1
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activemodel", ">= 3.2.13", "< 5.0.0.beta1"
21
+ spec.add_dependency "activemodel", ">= 3.2.13", "< 5.0.0"
22
22
  spec.add_dependency "activesupport"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
25
25
  spec.add_development_dependency "minitest", ">= 5.6"
26
26
  spec.add_development_dependency "rake", ">= 10.0"
27
- spec.add_development_dependency "activerecord", ">= 3.2.13", "< 5.0.0.beta1"
27
+ spec.add_development_dependency "activerecord", ">= 3.2.13", "< 5.0.0"
28
28
  spec.add_development_dependency "sqlite3"
29
29
  end
@@ -117,6 +117,29 @@ module ActiveModel
117
117
  details[attribute.to_sym] << error
118
118
  add_without_details(attribute, message, options)
119
119
  end
120
+
121
+ def marshal_dump
122
+ [@base, without_default_proc(@messages), without_default_proc(@details)]
123
+ end
124
+
125
+ def marshal_load(array)
126
+ @base, @messages, @details = array
127
+ apply_default_array(@messages)
128
+ apply_default_array(@details)
129
+ end
130
+
131
+ private
132
+
133
+ def without_default_proc(hash)
134
+ hash.dup.tap do |new_h|
135
+ new_h.default_proc = nil
136
+ end
137
+ end
138
+
139
+ def apply_default_array(hash)
140
+ hash.default_proc = proc { |h, key| h[key] = [] }
141
+ hash
142
+ end
120
143
  end
121
144
  end
122
145
 
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  module ErrorsDetails
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
@@ -89,4 +89,13 @@ class TestErrorsDetails < MiniTest::Test
89
89
 
90
90
  assert_empty person.errors.details
91
91
  end
92
+
93
+ def test_errors_are_marshalable
94
+ errors = ActiveModel::Errors.new(Person.new)
95
+ errors.add(:name, :invalid)
96
+ serialized = Marshal.load(Marshal.dump(errors))
97
+
98
+ assert_equal errors.messages, serialized.messages
99
+ assert_equal errors.details, serialized.details
100
+ end
92
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model-errors_details
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojciech Wnętrzak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-31 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.2.13
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 5.0.0.beta1
22
+ version: 5.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.2.13
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 5.0.0.beta1
32
+ version: 5.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ dependencies:
95
95
  version: 3.2.13
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
- version: 5.0.0.beta1
98
+ version: 5.0.0
99
99
  type: :development
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -105,7 +105,7 @@ dependencies:
105
105
  version: 3.2.13
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
- version: 5.0.0.beta1
108
+ version: 5.0.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: sqlite3
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.5.1
162
+ rubygems_version: 2.6.6
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Adds ActiveModel::Errors#details to return type of used validator