diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 30b8283..aac42e3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -19,14 +19,6 @@ Lint/SendWithMixinArgument: Exclude: - 'lib/commentable_methods.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: strict, consistent -Lint/SymbolConversion: - Exclude: - - 'lib/commentable_methods.rb' - # Offense count: 5 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: diff --git a/lib/commentable_methods.rb b/lib/commentable_methods.rb index 25cbff7..c4c7f68 100644 --- a/lib/commentable_methods.rb +++ b/lib/commentable_methods.rb @@ -12,9 +12,9 @@ module HelperMethods private def define_role_based_inflection(role) - return if method_defined?("#{role}_comments".to_sym) + return if method_defined?(:"#{role}_comments") - has_many "#{role}_comments".to_sym, + has_many :"#{role}_comments", -> { where(role: role.to_s) }, **has_many_options(role) end