On Ruby on Rails, how do we print debug info inside of a controller?

In the controller you can:

render :text => @some_object.inspect

But your view won’t be rendered.

You could also:

Rails.logger.debug("My object: #{@some_object.inspect}")

and run tail on log/development.log to see the output.

In the view the recommeneded way is:

<%= debug(@some_object) %>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)