-1

So in python/django I can just put the line print 'something' in my code and something will get printed to the console. How do I do this in Rails? I'm on Mac using Pow as my development server.

tadasajon
  • 14,276
  • 29
  • 92
  • 144
  • Downvote for lack of research effort. Possible duplicate of http://stackoverflow.com/questions/14961691/write-to-rails-console. You can use [`puts`](http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-puts). – admdrew Dec 17 '14 at 16:29
  • Why would I put in research effort when I can just ask on StackOverflow? – tadasajon Dec 17 '14 at 16:31
  • http://stackoverflow.com/help/how-to-ask. Also, the downvote is explicitly for lack of research (mouseover the down arrow). – admdrew Dec 17 '14 at 16:32
  • **Why would I put in research effort when I can just ask on StackOverflow?** laziest comment ever. Amazingly, and I know this might be hard to believe but most programming languages have a `print` method. I know crazy right? – engineersmnky Dec 17 '14 at 18:12
  • Yeah, I know there is a print method - the question is how I can view the output. – tadasajon Dec 17 '14 at 19:56

1 Answers1

3

Pow stores log files for your apps in ~/Library/Logs/Pow/apps. You can cd to this directory in your terminal and then run tail -f my_app.log to view your log as it updates (-f is for 'follow'). You can then print from your ruby/rails scripts using the puts command and the output will appear in this log file.

tadasajon
  • 14,276
  • 29
  • 92
  • 144