Write to rails console
puts
or p
is a good start to do that.
p "asd" # => "asd"
puts "asd" # => asd
here is more information about that: http://www.ruby-doc.org/core-1.9.3/ARGF.html
As other have said, you want to use either puts
or p
. Why? Is that magic?
Actually not. A rails console is, under the hood, an IRB, so all you can do in IRB you will be able to do in a rails console. Since for printing in an IRB we use puts
, we use the same command for printing in a rails console.
You can actually take a look at the console code in the rails source code. See the require of irb? :)