From 3f074dcc543e188fed641f592e65a3ba71e4233d Mon Sep 17 00:00:00 2001 From: Paulo Fidalgo Date: Thu, 4 May 2023 11:53:34 +0200 Subject: [PATCH] Allow NotNullColumn to work with method calls At the NotNullColumn if a method is passed as arguments for `add_column` an error is trigger. In this commit we check if the argument is a method and return it's name as a String. Fixes #997 --- lib/rubocop/cop/rails/not_null_column.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rubocop/cop/rails/not_null_column.rb b/lib/rubocop/cop/rails/not_null_column.rb index 7f8e41c8be..332a3a7a9d 100644 --- a/lib/rubocop/cop/rails/not_null_column.rb +++ b/lib/rubocop/cop/rails/not_null_column.rb @@ -45,7 +45,8 @@ def on_send(node) def check_add_column(node) add_not_null_column?(node) do |type, pairs| - return if type.value == :virtual || type.value == 'virtual' + type_value = type.send_type? ? type.method_name.to_s : type.value + return if [:virtual, 'virtual'].include?(type_value) check_pairs(pairs) end