Ruby: console.log?
RubyRuby Problem Overview
I recently put console.log statements in every line of a JavaScript program and found that it's now much easier to understand. Is there a way to do that with server side code, specifically Ruby? I presume there's no way to read it in firebug, but would it be visible in irb? what console.log equivalent statements would I put in the Ruby code?
Ruby Solutions
Solution 1 - Ruby
puts
is the equivalent in ruby.
Example
puts 'Hello World!'
Solution 2 - Ruby
If you are running your server in the console, you can use puts
. Otherwise, you will need to write to a file, possibly via a logger (like Rails.logger.info
).