diff --git a/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb index f07dc156f1..302532a488 100644 --- a/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb +++ b/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb @@ -160,7 +160,7 @@ def receiver_matcher(node) end def model_file? - processed_source.buffer.name.include?('/models/') + processed_source.file_path.include?('/models/') end end end