Byebug with ActiveRecord in Rails 6 is not logging as expected in my test environment.
When I run a test and use byebug to pause execution ActiveRecord is not logging queries to the console. For example, if I type Candidate.second
I see no SQL output:
What I would like to see, and what I do see if I run the same query in my development environment within the rails console:
I've looked through documentation on both ActiveRecord and ByeBug but can't seem to solve this. Any help is appreciated!
Steps to reproduce
Throw a debugger statement into a controller, and run a test:
ActiveRecord is not logging queries into the console when using byebug. For example, if a run a test that hits a controller action:
class JobsController < ApplicationController
# ...
def show
debugger
Candidate.first # arbitrary query
render json: @job
end
end
From the terminal:
rails test test/controllers/jobs_controller.rb