From d43b521fd5d1dfb641b876f78ad30983568073a1 Mon Sep 17 00:00:00 2001 From: r7kamura Date: Fri, 29 May 2020 14:55:24 +0900 Subject: [PATCH] Fix keyword-arguments warnings `has_many` takes keyword-arguments. > warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call --- lib/commentable_methods.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/commentable_methods.rb b/lib/commentable_methods.rb index c1bdc7f..b801bfe 100644 --- a/lib/commentable_methods.rb +++ b/lib/commentable_methods.rb @@ -17,13 +17,13 @@ def define_role_based_inflection(role) def define_role_based_inflection_3(role) has_many "#{role.to_s}_comments".to_sym, - has_many_options(role).merge(:conditions => { role: role.to_s }) + **has_many_options(role).merge(:conditions => { role: role.to_s }) end def define_role_based_inflection_4(role) has_many "#{role.to_s}_comments".to_sym, -> { where(role: role.to_s) }, - has_many_options(role) + **has_many_options(role) end def has_many_options(role) @@ -53,9 +53,9 @@ def acts_as_commentable(*args) comment_roles.each do |role| define_role_based_inflection(role) end - has_many :all_comments, { :as => :commentable, :dependent => :destroy, class_name: 'Comment' }.merge(join_options) + has_many :all_comments, **{ :as => :commentable, :dependent => :destroy, class_name: 'Comment' }.merge(join_options) else - has_many :comments, {:as => :commentable, :dependent => :destroy}.merge(join_options) + has_many :comments, **{:as => :commentable, :dependent => :destroy}.merge(join_options) end comment_types.each do |role|