Are there simple ways to print debug strings in Rails? Something like the OutputDebugString() function in Windows.
Are there simple ways to print debug strings in Rails? Something like the OutputDebugString()
Share
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.
http://guides.rubyonrails.org/debugging_rails_applications.html
“To write in the current log use the logger.(debug|info|warn|error|fatal) method from within a controller, model or mailer:”
You could also use raise object.inspect.
Or, if you want more powerful debugging tool, take a look at pry: http://railscasts.com/episodes/280-pry-with-rails
binding.pryin your code and you’ll be able to debug ALL THE THINGS!