Skip to content

Commit 435a693

Browse files
committed
Fixup enum schema methods' signature to accept kwargs
As of Ruby 3.0, `def method_name(*)` doesn't accept kwargs.
1 parent f79f0b5 commit 435a693

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

activerecord/lib/active_record/connection_adapters/abstract_adapter.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,23 +576,23 @@ def enable_extension(name, **)
576576
end
577577

578578
# This is meant to be implemented by the adapters that support custom enum types
579-
def create_enum(*) # :nodoc:
579+
def create_enum(...) # :nodoc:
580580
end
581581

582582
# This is meant to be implemented by the adapters that support custom enum types
583-
def drop_enum(*) # :nodoc:
583+
def drop_enum(...) # :nodoc:
584584
end
585585

586586
# This is meant to be implemented by the adapters that support custom enum types
587-
def rename_enum(*) # :nodoc:
587+
def rename_enum(...) # :nodoc:
588588
end
589589

590590
# This is meant to be implemented by the adapters that support custom enum types
591-
def add_enum_value(*) # :nodoc:
591+
def add_enum_value(...) # :nodoc:
592592
end
593593

594594
# This is meant to be implemented by the adapters that support custom enum types
595-
def rename_enum_value(*) # :nodoc:
595+
def rename_enum_value(...) # :nodoc:
596596
end
597597

598598
# This is meant to be implemented by the adapters that support virtual tables

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,14 @@ def drop_enum(name, values = nil, **options)
575575
end
576576

577577
# Rename an existing enum type to something else.
578-
def rename_enum(name, options = {})
578+
def rename_enum(name, **options)
579579
to = options.fetch(:to) { raise ArgumentError, ":to is required" }
580580

581581
exec_query("ALTER TYPE #{quote_table_name(name)} RENAME TO #{to}").tap { reload_type_map }
582582
end
583583

584584
# Add enum value to an existing enum type.
585-
def add_enum_value(type_name, value, options = {})
585+
def add_enum_value(type_name, value, **options)
586586
before, after = options.values_at(:before, :after)
587587
sql = +"ALTER TYPE #{quote_table_name(type_name)} ADD VALUE"
588588
sql << " IF NOT EXISTS" if options[:if_not_exists]
@@ -600,7 +600,7 @@ def add_enum_value(type_name, value, options = {})
600600
end
601601

602602
# Rename enum value on an existing enum type.
603-
def rename_enum_value(type_name, options = {})
603+
def rename_enum_value(type_name, **options)
604604
unless database_version >= 10_00_00 # >= 10.0
605605
raise ArgumentError, "Renaming enum values is only supported in PostgreSQL 10 or later"
606606
end

0 commit comments

Comments
 (0)