Well the title explains pretty much everything.
I want to use something like
p something
And be able to see the output in the website, just for the sake of debugging.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suspect you’re coming from PHP, because this is a very PHP-esque thing to want to do. Standard output isn’t sent to the browser in Rails, something PHP developers take for granted.
If you want to see something in browser, you need to render it.
From a view you can use the
debughelper to “vardump” a value:From a controller you can quickly see the value of a variable using
render :inline => p(something)orrender :inline => something.inspect. Make sure youreturnafterwards or otherwise prevent yourself from reaching a secondrendercall.You should get used
tailing your log files, and making use of the Rails logger.