Ruby

Ruby

Made by DeepSource

Blocks should be used for interpolated strings passed to Rails.logger.debug RB-W1009

Anti-pattern
Minor
Autofix

By default, Rails production environments use the :info log level. At the :info log level, Rails.logger.debug statements do not result in log output.

However, Ruby must eagerly evaluate interpolated string arguments passed as method arguments. Passing a block to Rails.logger.debug prevents costly evaluation of interpolated strings when no output would be produced anyway.

Bad practice

logger.debug "Person attributes hash: #{@person.attributes.inspect}"

Recommended

logger.debug { "Person attributes hash: #{@person.attributes.inspect}" }