Ruby: logger.debug with an array

When you try logging something like:

logger.debug(“This won’t work: ” + @anarray)

you’ll get a syntax error:

     TypeError (no implicit conversion of Array into String):

Instead use .inspect

e.g. this will work:

logger.debug(“This will work: ” + @anarray.inspect)

See also:

Leave a Reply

Your email address will not be published. Required fields are marked *