1

My terminal used to display SQL table insert statements (as it should by default), and now it doesn't. Everything else - for example, GET requests, or local server startup info, or job completion notifications - appear as normal.

For the life of me, I can't figure out what the problem could be. I've been searching for a long time and can't figure out any reason this would happen. Do you have any ideas to point me in the right direction?

4

1 回答 1

2

将它放在主目录中的 .irbrc 或 .pryrc 中

if defined?(Rails) && !Rails.env.nil?
  puts '... ActiveRecord and ActiveResource Logger set to STDOUT'
  logger = Logger.new(STDOUT)
  ActiveRecord::Base.logger = logger
  ActiveResource::Base.logger = logger
end

您应该开始看到在 rails 控制台中执行的 sql 语句。希望这可以帮助

于 2013-05-15T22:07:09.223 回答