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

Don't know about print, but puts never failed me. Your hello world will be in console and logs and normal flow will continue.
Did I understand you correctly?


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) %>

you can use abort with inspect

abort params[:whatevs].inspect

or

abort @my_variable.inspect

for JSON format

render json: JSON.pretty_generate(JSON.parse(@my_variable.to_json))

You can debug in the view: <%= debug @post %>. More info: http://guides.rubyonrails.org/debugging_rails_applications.html