activemodel 6.0.2.2 → 6.0.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -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 +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 595c281f790035eac513203ea725bf7a50aa7e504965776c94f46a33ca502532
|
4
|
+
data.tar.gz: c33cec437112dd55798c8523aa7d2dbc94d6f7b0af0ecbae328e0efb9ecceb82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9c0c71976e3affc15397abf6512ed0c234b799fcab6037bb8253472a30b2e4456ba69cc2c1a0f3980079a407bc0d34736928a8649cc45641662fc674332666
|
7
|
+
data.tar.gz: 94a1fa2806e4d298845874f1a533c5d94ed5356f69df39ba12f44645a38ec615db23bb88f139374a4901e437cfebfb1c07731fee69cc6e4017a87a8e03c59911
|
data/CHANGELOG.md
CHANGED
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.
|
4
|
+
version: 6.0.3.rc1
|
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: 2020-
|
11
|
+
date: 2020-05-01 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.
|
19
|
+
version: 6.0.3.rc1
|
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.
|
26
|
+
version: 6.0.3.rc1
|
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,10 +102,10 @@ 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.
|
106
|
-
documentation_uri: https://api.rubyonrails.org/v6.0.
|
107
|
-
mailing_list_uri: https://
|
108
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.0.
|
105
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.3.rc1/activemodel/CHANGELOG.md
|
106
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.3.rc1/
|
107
|
+
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
108
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.3.rc1/activemodel
|
109
109
|
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
@@ -117,11 +117,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: 2.5.0
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- - "
|
120
|
+
- - ">"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: 1.3.1
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
124
|
+
rubygems_version: 3.1.2
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A toolkit for building modeling frameworks (part of Rails).
|