activemodel 5.0.0.rc2 → 5.0.0
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 +1 -20
- data/lib/active_model/errors.rb +14 -3
- data/lib/active_model/gem_version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f48403097ada0a83a60381bb5fadd9dd3db8d18d
|
4
|
+
data.tar.gz: 09c5350eff58df91adbe0817796cdcf721896687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 392b61a079d2fa9cbd7f95b7170cfc4fcc2150eccd12bbb95e32c75e103ca875d02d638620455deafb97c8c5edd2a0e34e546d1a628387c2555bd35c500c09c0
|
7
|
+
data.tar.gz: ac45013f52613dabfddb2326bc657539f4c5f4df610fc7a723a5783e23875846acc6c086c7e379c55627aef4a563ef7a4fd60985a0a58bff5dd8a7ea1f94e10d
|
data/CHANGELOG.md
CHANGED
@@ -1,34 +1,15 @@
|
|
1
|
-
## Rails 5.0.0
|
1
|
+
## Rails 5.0.0 (June 30, 2016) ##
|
2
2
|
|
3
3
|
* Ensure that instances of `ActiveModel::Errors` can be marshalled.
|
4
4
|
Fixes #25165.
|
5
5
|
|
6
6
|
*Sean Griffin*
|
7
7
|
|
8
|
-
## Rails 5.0.0.rc1 (May 06, 2016) ##
|
9
|
-
|
10
|
-
* No changes.
|
11
|
-
|
12
|
-
|
13
|
-
## Rails 5.0.0.beta4 (April 27, 2016) ##
|
14
|
-
|
15
8
|
* Allow passing record being validated to the message proc to generate
|
16
9
|
customized error messages for that object using I18n helper.
|
17
10
|
|
18
11
|
*Prathamesh Sonpatki*
|
19
12
|
|
20
|
-
## Rails 5.0.0.beta3 (February 24, 2016) ##
|
21
|
-
|
22
|
-
* No changes.
|
23
|
-
|
24
|
-
|
25
|
-
## Rails 5.0.0.beta2 (February 01, 2016) ##
|
26
|
-
|
27
|
-
* No changes.
|
28
|
-
|
29
|
-
|
30
|
-
## Rails 5.0.0.beta1 (December 18, 2015) ##
|
31
|
-
|
32
13
|
* Validate multiple contexts on `valid?` and `invalid?` at once.
|
33
14
|
|
34
15
|
Example:
|
data/lib/active_model/errors.rb
CHANGED
@@ -147,9 +147,9 @@ module ActiveModel
|
|
147
147
|
|
148
148
|
# Delete messages for +key+. Returns the deleted messages.
|
149
149
|
#
|
150
|
-
# person.errors[:name]
|
150
|
+
# person.errors[:name] # => ["cannot be nil"]
|
151
151
|
# person.errors.delete(:name) # => ["cannot be nil"]
|
152
|
-
# person.errors[:name]
|
152
|
+
# person.errors[:name] # => []
|
153
153
|
def delete(key)
|
154
154
|
details.delete(key)
|
155
155
|
messages.delete(key)
|
@@ -385,7 +385,18 @@ module ActiveModel
|
|
385
385
|
# present, +false+ otherwise. +message+ is treated the same as for +add+.
|
386
386
|
#
|
387
387
|
# person.errors.add :name, :blank
|
388
|
-
# person.errors.added? :name, :blank
|
388
|
+
# person.errors.added? :name, :blank # => true
|
389
|
+
# person.errors.added? :name, "can't be blank" # => true
|
390
|
+
#
|
391
|
+
# If the error message requires an option, then it returns +true+ with
|
392
|
+
# the correct option, or +false+ with an incorrect or missing option.
|
393
|
+
#
|
394
|
+
# person.errors.add :name, :too_long, { count: 25 }
|
395
|
+
# person.errors.added? :name, :too_long, count: 25 # => true
|
396
|
+
# person.errors.added? :name, "is too long (maximum is 25 characters)" # => true
|
397
|
+
# person.errors.added? :name, :too_long, count: 24 # => false
|
398
|
+
# person.errors.added? :name, :too_long # => false
|
399
|
+
# person.errors.added? :name, "is too long" # => false
|
389
400
|
def added?(attribute, message = :invalid, options = {})
|
390
401
|
message = message.call if message.respond_to?(:call)
|
391
402
|
message = normalize_message(attribute, message, options)
|
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
|
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-06-
|
11
|
+
date: 2016-06-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.0.0
|
19
|
+
version: 5.0.0
|
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
|
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.
|
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: 2.2.2
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
116
|
rubygems_version: 2.6.4
|