Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Rails >6 add_column and column receive keyword arguments now #2671

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gabrielengel
Copy link

Please see:
https://apidock.com/rails/v6.0.0/ActiveRecord/ConnectionAdapters/SchemaStatements/add_column

# Before:
add_column(table_name, column_name, type, options = {}) public

# Currently (after Rails 6.0.0)
add_column(table_name, column_name, type, **options) public

@@ -51,7 +51,7 @@ def attachment(*attachment_names)
attachment_names.each do |attachment_name|
COLUMNS.each_pair do |column_name, column_type|
column_options = options.merge(options[column_name.to_sym] || {})
column("#{attachment_name}_#{column_name}", column_type, column_options)
column("#{attachment_name}_#{column_name}", column_type, *column_options)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [85/80]

@@ -24,7 +24,7 @@ def add_attachment(table_name, *attachment_names)
attachment_names.each do |attachment_name|
COLUMNS.each_pair do |column_name, column_type|
column_options = options.merge(options[column_name.to_sym] || {})
add_column(table_name, "#{attachment_name}_#{column_name}", column_type, column_options)
add_column(table_name, "#{attachment_name}_#{column_name}", column_type, *column_options)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [101/80]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant