From 0aad49d51358fce3b36b856e09e99486bb257f02 Mon Sep 17 00:00:00 2001 From: aschurg Date: Thu, 28 Jul 2022 15:26:20 -0600 Subject: [PATCH] Add support for Ruby 3 code taken from this unmerged pull request: https://github.com/jackdempsey/acts_as_commentable/pull/76 --- 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|