activemodel 6.0.2.1 → 6.0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.rdoc +1 -1
- data/lib/active_model/attribute_assignment.rb +0 -1
- data/lib/active_model/attribute_methods.rb +2 -0
- data/lib/active_model/attribute_set.rb +0 -2
- data/lib/active_model/attributes.rb +0 -2
- data/lib/active_model/callbacks.rb +0 -1
- data/lib/active_model/dirty.rb +1 -1
- data/lib/active_model/errors.rb +2 -2
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/naming.rb +1 -2
- data/lib/active_model/serialization.rb +0 -1
- data/lib/active_model/translation.rb +1 -1
- data/lib/active_model/type/big_integer.rb +0 -1
- data/lib/active_model/type/boolean.rb +0 -1
- data/lib/active_model/type/date.rb +0 -1
- data/lib/active_model/type/date_time.rb +0 -1
- data/lib/active_model/type/decimal.rb +0 -1
- data/lib/active_model/type/float.rb +0 -1
- data/lib/active_model/type/helpers/numeric.rb +0 -1
- data/lib/active_model/type/helpers/time_value.rb +0 -1
- data/lib/active_model/type/immutable_string.rb +0 -1
- data/lib/active_model/type/integer.rb +1 -1
- data/lib/active_model/type/registry.rb +4 -3
- data/lib/active_model/type/string.rb +0 -1
- data/lib/active_model/type/time.rb +0 -1
- data/lib/active_model/type/value.rb +0 -1
- data/lib/active_model/validations.rb +0 -1
- data/lib/active_model/validations/absence.rb +1 -1
- data/lib/active_model/validations/acceptance.rb +0 -1
- data/lib/active_model/validations/callbacks.rb +0 -1
- data/lib/active_model/validations/clusivity.rb +0 -1
- data/lib/active_model/validations/format.rb +1 -2
- data/lib/active_model/validations/numericality.rb +3 -2
- data/lib/active_model/validations/validates.rb +0 -1
- data/lib/active_model/validator.rb +0 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c72e24b51aad0dbe8fb35b8387aff6a1985d4a0b3c733b99d5df7e981946ccf1
|
4
|
+
data.tar.gz: 8fee375a9932f90d17a75081ada0de6d5d02975847feca52e47ac02fa11af46d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11377ef7fb923a77472eef17be41bde6d87f8e2edba93e0e098688182d60bcc9b9f32806394e462739d2deff8888eaf8f94bca7fb6d0e7e1f78307b48692f63e
|
7
|
+
data.tar.gz: d1c959b3159ac159659cf001b086577c8279cbb9df7bdfbfac6a6775bdaea44f74284e98aecf5ee7316eb4ca346408dee6ef8c4f84ad211d04124a782af2e63a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## Rails 6.0.3.2 (June 17, 2020) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 6.0.3.1 (May 18, 2020) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 6.0.3 (May 06, 2020) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 6.0.2.2 (March 19, 2020) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
1
21
|
## Rails 6.0.2.1 (December 18, 2019) ##
|
2
22
|
|
3
23
|
* No changes.
|
data/README.rdoc
CHANGED
@@ -263,4 +263,4 @@ Bug reports for the Ruby on Rails project can be filed here:
|
|
263
263
|
|
264
264
|
Feature requests should be discussed on the rails-core mailing list here:
|
265
265
|
|
266
|
-
* https://
|
266
|
+
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
@@ -382,6 +382,7 @@ module ActiveModel
|
|
382
382
|
#{defn}
|
383
383
|
#{body}
|
384
384
|
end
|
385
|
+
ruby2_keywords(:'#{name}') if respond_to?(:ruby2_keywords, true)
|
385
386
|
RUBY
|
386
387
|
end
|
387
388
|
|
@@ -431,6 +432,7 @@ module ActiveModel
|
|
431
432
|
match ? attribute_missing(match, *args, &block) : super
|
432
433
|
end
|
433
434
|
end
|
435
|
+
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
|
434
436
|
|
435
437
|
# +attribute_missing+ is like +method_missing+, but for attributes. When
|
436
438
|
# +method_missing+ is called we check to see if there is a matching
|
@@ -42,7 +42,6 @@ module ActiveModel
|
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
|
-
|
46
45
|
def define_method_attribute=(name)
|
47
46
|
ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method(
|
48
47
|
generated_attribute_methods, name, writer: true,
|
@@ -114,7 +113,6 @@ module ActiveModel
|
|
114
113
|
end
|
115
114
|
|
116
115
|
private
|
117
|
-
|
118
116
|
def write_attribute(attr_name, value)
|
119
117
|
name = attr_name.to_s
|
120
118
|
name = self.class.attribute_aliases[name] || name
|
data/lib/active_model/dirty.rb
CHANGED
@@ -167,7 +167,7 @@ module ActiveModel
|
|
167
167
|
|
168
168
|
# Dispatch target for <tt>*_changed?</tt> attribute methods.
|
169
169
|
def attribute_changed?(attr_name, **options) # :nodoc:
|
170
|
-
mutations_from_database.changed?(attr_name.to_s, options)
|
170
|
+
mutations_from_database.changed?(attr_name.to_s, **options)
|
171
171
|
end
|
172
172
|
|
173
173
|
# Dispatch target for <tt>*_was</tt> attribute methods.
|
data/lib/active_model/errors.rb
CHANGED
@@ -497,7 +497,7 @@ module ActiveModel
|
|
497
497
|
defaults << :"#{i18n_scope}.errors.messages.#{type}"
|
498
498
|
|
499
499
|
catch(:exception) do
|
500
|
-
translation = I18n.translate(defaults.first, options.merge(default: defaults.drop(1), throw: true))
|
500
|
+
translation = I18n.translate(defaults.first, **options.merge(default: defaults.drop(1), throw: true))
|
501
501
|
return translation unless translation.nil?
|
502
502
|
end unless options[:message]
|
503
503
|
else
|
@@ -511,7 +511,7 @@ module ActiveModel
|
|
511
511
|
defaults = options.delete(:message) if options[:message]
|
512
512
|
options[:default] = defaults
|
513
513
|
|
514
|
-
I18n.translate(key, options)
|
514
|
+
I18n.translate(key, **options)
|
515
515
|
end
|
516
516
|
|
517
517
|
def marshal_dump # :nodoc:
|
data/lib/active_model/naming.rb
CHANGED
@@ -203,11 +203,10 @@ module ActiveModel
|
|
203
203
|
defaults << @human
|
204
204
|
|
205
205
|
options = { scope: [@klass.i18n_scope, :models], count: 1, default: defaults }.merge!(options.except(:default))
|
206
|
-
I18n.translate(defaults.shift, options)
|
206
|
+
I18n.translate(defaults.shift, **options)
|
207
207
|
end
|
208
208
|
|
209
209
|
private
|
210
|
-
|
211
210
|
def _singularize(string)
|
212
211
|
ActiveSupport::Inflector.underscore(string).tr("/", "_")
|
213
212
|
end
|
@@ -150,7 +150,6 @@ module ActiveModel
|
|
150
150
|
end
|
151
151
|
|
152
152
|
private
|
153
|
-
|
154
153
|
# Hook method defining how an attribute value should be retrieved for
|
155
154
|
# serialization. By default this is assumed to be an instance named after
|
156
155
|
# the attribute. Override this method in subclasses should you need to
|
@@ -10,14 +10,15 @@ module ActiveModel
|
|
10
10
|
|
11
11
|
def register(type_name, klass = nil, **options, &block)
|
12
12
|
block ||= proc { |_, *args| klass.new(*args) }
|
13
|
+
block.ruby2_keywords if block.respond_to?(:ruby2_keywords)
|
13
14
|
registrations << registration_klass.new(type_name, block, **options)
|
14
15
|
end
|
15
16
|
|
16
|
-
def lookup(symbol, *args)
|
17
|
-
registration = find_registration(symbol, *args)
|
17
|
+
def lookup(symbol, *args, **kwargs)
|
18
|
+
registration = find_registration(symbol, *args, **kwargs)
|
18
19
|
|
19
20
|
if registration
|
20
|
-
registration.call(self, symbol, *args)
|
21
|
+
registration.call(self, symbol, *args, **kwargs)
|
21
22
|
else
|
22
23
|
raise ArgumentError, "Unknown type #{symbol.inspect}"
|
23
24
|
end
|
@@ -11,7 +11,7 @@ module ActiveModel
|
|
11
11
|
|
12
12
|
module HelperMethods
|
13
13
|
# Validates that the specified attributes are blank (as defined by
|
14
|
-
# Object#
|
14
|
+
# Object#present?). Happens by default on save.
|
15
15
|
#
|
16
16
|
# class Person < ActiveRecord::Base
|
17
17
|
# validates_absence_of :first_name
|
@@ -6,7 +6,7 @@ module ActiveModel
|
|
6
6
|
def validate_each(record, attribute, value)
|
7
7
|
if options[:with]
|
8
8
|
regexp = option_call(record, :with)
|
9
|
-
record_error(record, attribute, :with, value) if value.to_s
|
9
|
+
record_error(record, attribute, :with, value) if !value.to_s&.match?(regexp)
|
10
10
|
elsif options[:without]
|
11
11
|
regexp = option_call(record, :without)
|
12
12
|
record_error(record, attribute, :without, value) if regexp.match?(value.to_s)
|
@@ -23,7 +23,6 @@ module ActiveModel
|
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
|
-
|
27
26
|
def option_call(record, name)
|
28
27
|
option = options[name]
|
29
28
|
option.respond_to?(:call) ? option.call(record) : option
|
@@ -13,6 +13,8 @@ module ActiveModel
|
|
13
13
|
|
14
14
|
INTEGER_REGEX = /\A[+-]?\d+\z/
|
15
15
|
|
16
|
+
HEXADECIMAL_REGEX = /\A[+-]?0[xX]/
|
17
|
+
|
16
18
|
def check_validity!
|
17
19
|
keys = CHECKS.keys - [:odd, :even]
|
18
20
|
options.slice(*keys).each do |option, value|
|
@@ -79,7 +81,6 @@ module ActiveModel
|
|
79
81
|
end
|
80
82
|
|
81
83
|
private
|
82
|
-
|
83
84
|
def is_number?(raw_value)
|
84
85
|
!parse_as_number(raw_value).nil?
|
85
86
|
rescue ArgumentError, TypeError
|
@@ -103,7 +104,7 @@ module ActiveModel
|
|
103
104
|
end
|
104
105
|
|
105
106
|
def is_hexadecimal_literal?(raw_value)
|
106
|
-
|
107
|
+
HEXADECIMAL_REGEX.match?(raw_value.to_s)
|
107
108
|
end
|
108
109
|
|
109
110
|
def filtered_options(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: 6.0.2
|
4
|
+
version: 6.0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-17 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: 6.0.2
|
19
|
+
version: 6.0.3.2
|
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: 6.0.2
|
26
|
+
version: 6.0.3.2
|
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.
|
@@ -102,11 +102,11 @@ licenses:
|
|
102
102
|
- MIT
|
103
103
|
metadata:
|
104
104
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
105
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.2
|
106
|
-
documentation_uri: https://api.rubyonrails.org/v6.0.2
|
107
|
-
mailing_list_uri: https://
|
108
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.0.2
|
109
|
-
post_install_message:
|
105
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.3.2/activemodel/CHANGELOG.md
|
106
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.3.2/
|
107
|
+
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
108
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.3.2/activemodel
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
@@ -121,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
-
signing_key:
|
124
|
+
rubygems_version: 3.1.2
|
125
|
+
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A toolkit for building modeling frameworks (part of Rails).
|
128
128
|
test_files: []
|