Take the 2-minute tour ×  I'm having a problem with a boolean
expression and when I did a logger.debug I had strange results,
so I simplified my logging code to the following and was
surprised not to see any 'false' being printed.  Logging code in
my controller:  logger.debug 'true' logger.debug true
logger.debug 'false' logger.debug false logger.debug '1 == 1'
logger.debug 1 == 1 logger.debug '1 == 0' logger.debug 1 == 0
Which prints out the following    1 == 1  1 == 0  ... ? I would
expect to see false. When I run '1 == 0' or 'puts false' in the
console I get false. Am I missing something?  Any ideas why
isn't it printing the 'false'?  ruby version: 1.8.7-p352  rails
version: 2.3.2  share|improve this question add comment  2
Answers  up vote 3 down vote accepted  Rails Logger uses || in
the code before running .to_s, which fails for nil and false.
def add(severity, message = nil, progname = nil, &block)
return if @level > severity   message = (message || (block &&
block.call) || progname).to_s ## <- th