1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Class#new also separates keyword arguments and optional hash"

This reverts commit 72c1aa21c1.

This causes CI fails on Ruby < 2.7
This commit is contained in:
Akira Matsuda 2019-09-08 09:44:47 +09:00
parent de3d9680ac
commit af99f45b58
10 changed files with 16 additions and 14 deletions

View file

@ -371,8 +371,10 @@ module ActiveModel
# person.errors.details
# # => {:base=>[{error: :name_or_email_blank}]}
def add(attribute, type = :invalid, **options)
attribute, type, options = normalize_arguments(attribute, type, **options)
error = Error.new(@base, attribute, type, **options)
error = Error.new(
@base,
*normalize_arguments(attribute, type, **options)
)
if exception = options[:strict]
exception = ActiveModel::StrictValidationFailed if exception == true

View file

@ -422,7 +422,7 @@ module ActiveRecord
# See {connection.add_reference}[rdoc-ref:SchemaStatements#add_reference] for details of the options you can use.
def references(*args, **options)
args.each do |ref_name|
ReferenceDefinition.new(ref_name, **options).add_to(self)
ReferenceDefinition.new(ref_name, options).add_to(self)
end
end
alias :belongs_to :references

View file

@ -10,7 +10,7 @@ module ActiveRecord
@registry ||= {}
end
def new(*, **)
def new(*)
super.deduplicate
end
end

View file

@ -186,7 +186,7 @@ module ActiveRecord
attr_reader :unlogged
def initialize(*, **)
def initialize(*)
super
@unlogged = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
end

View file

@ -110,8 +110,8 @@ module ActiveRecord
end
module ClassMethods # :nodoc:
def create(klass, *args, **options)
relation_class_for(klass).new(klass, *args, **options)
def create(klass, *args)
relation_class_for(klass).new(klass, *args)
end
private

View file

@ -121,7 +121,7 @@ module ActiveSupport
# (Backtrace information…)
# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
class DeprecatedConstantProxy < Module
def self.new(*args, **options, &block)
def self.new(*args, &block)
object = args.first
return object unless object

View file

@ -94,7 +94,7 @@ module ActiveSupport
end
def handle_missing_key
raise MissingKeyError.new(key_path: key_path, env_key: env_key) if raise_if_missing_key
raise MissingKeyError, key_path: key_path, env_key: env_key if raise_if_missing_key
end
end
end

View file

@ -26,7 +26,7 @@ module ActiveSupport
private
def build_rotation(secret = @secret, sign_secret = @sign_secret, options)
self.class.new(secret, sign_secret, **options)
self.class.new(secret, sign_secret, options)
end
end
@ -39,7 +39,7 @@ module ActiveSupport
private
def build_rotation(secret = @secret, options)
self.class.new(secret, **options)
self.class.new(secret, options)
end
end

View file

@ -244,7 +244,7 @@ class MessageEncryptorMetadataTest < ActiveSupport::TestCase
setup do
@secret = SecureRandom.random_bytes(32)
@encryptor = ActiveSupport::MessageEncryptor.new(@secret, **encryptor_options)
@encryptor = ActiveSupport::MessageEncryptor.new(@secret, encryptor_options)
end
private
@ -256,7 +256,7 @@ class MessageEncryptorMetadataTest < ActiveSupport::TestCase
@encryptor.decrypt_and_verify(data, **options)
end
def encryptor_options; {} end
def encryptor_options; end
end
class MessageEncryptorMetadataMarshalTest < MessageEncryptorMetadataTest

View file

@ -142,7 +142,7 @@ class MessageVerifierMetadataTest < ActiveSupport::TestCase
include SharedMessageMetadataTests
setup do
@verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", **verifier_options)
@verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", verifier_options)
end
def test_verify_raises_when_purpose_differs