Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"puts" method in rails 3

I've been doing some development with rails 3 and I was wondering why calling the "puts" method doesn't output to standard out.

How do I get this back?

like image 314
Paul Johnson Avatar asked Dec 14 '10 09:12

Paul Johnson


2 Answers

Instead of puts, use logger.info:

logger.info @collection.inspect
like image 67
Brian Rose Avatar answered Nov 04 '22 09:11

Brian Rose


You can also use the standard ruby way by calling STDOUT << 'your output'. Method put is not a rails speciality, it comes with ruby. If you use rails, you can also rely on the logger object.

like image 26
fifigyuri Avatar answered Nov 04 '22 08:11

fifigyuri