简体   繁体   English

rails中的“puts”方法3

[英]“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. 我一直在使用rails 3进行一些开发,我想知道为什么调用“puts”方法不会输出到标准输出。

How do I get this back? 我怎么得到这个?

取而代之的puts ,使用logger.info

logger.info @collection.inspect

You can also use the standard ruby way by calling STDOUT << 'your output' . 你也可以通过调用STDOUT << 'your output'来使用标准的ruby方式。 Method put is not a rails speciality, it comes with ruby. 方法put不是铁路专业,它带有红宝石。 If you use rails, you can also rely on the logger object. 如果使用rails,则还可以依赖logger对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM