Is there a print_r or var_dump equivalent in Ruby on Rails?

Ruby on rails is the dynamic tool for making web applications. Things are very abstract in Ruby on rails. If we do not have internals about things we will find that most of the things are happening but we don’t have enough insight into it.

It is an obvious question that how do we dump a variable in Ruby on rails. In PHP or JavaScript dumping a variable is really easy. It is also easy in rails too.

Dump a variable in controller

puts variable
puts variable.inspect
puts variable.to_yaml

Dump a variable in view

<%= theobject.inspect %>

More source