Fix deprecated keyword argument warnings in Ruby 2.7.

Fix this warning:

    warning: Using the last argument as keyword parameters is
    deprecated; maybe ** should be added to the call.

ref: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/#delegation
This commit is contained in:
evazion
2020-02-16 18:44:23 -06:00
parent af4891bf4c
commit ed702b8854
3 changed files with 8 additions and 8 deletions

View File

@@ -236,8 +236,8 @@ module ApplicationHelper
simple_form_for(model, **options, &block) simple_form_for(model, **options, &block)
end end
def table_for(*options, &block) def table_for(*args, **options, &block)
table = TableBuilder.new(*options, &block) table = TableBuilder.new(*args, **options, &block)
render "table_builder/table", table: table render "table_builder/table", table: table
end end

View File

@@ -49,8 +49,8 @@ class TableBuilder
yield self if block_given? yield self if block_given?
end end
def column(*options, &block) def column(*args, **options, &block)
@columns << Column.new(*options, &block) @columns << Column.new(*args, **options, &block)
end end
def all_row_attributes(item, i) def all_row_attributes(item, i)

View File

@@ -3,8 +3,8 @@ class ApplicationRecord < ActiveRecord::Base
concerning :PaginationMethods do concerning :PaginationMethods do
class_methods do class_methods do
def paginate(*options) def paginate(*args, **options)
extending(PaginationExtension).paginate(*options) extending(PaginationExtension).paginate(*args, **options)
end end
def paginated_search(params, defaults: {}, count_pages: params[:search].present?) def paginated_search(params, defaults: {}, count_pages: params[:search].present?)
@@ -413,9 +413,9 @@ class ApplicationRecord < ActiveRecord::Base
concerning :UserMethods do concerning :UserMethods do
class_methods do class_methods do
def belongs_to_updater(options = {}) def belongs_to_updater(**options)
class_eval do class_eval do
belongs_to :updater, options.merge(class_name: "User") belongs_to :updater, class_name: "User", **options
before_validation do |rec| before_validation do |rec|
rec.updater_id = CurrentUser.id rec.updater_id = CurrentUser.id
rec.updater_ip_addr = CurrentUser.ip_addr if rec.respond_to?(:updater_ip_addr=) rec.updater_ip_addr = CurrentUser.ip_addr if rec.respond_to?(:updater_ip_addr=)