During development we always need to print the objects in views for debug. In Rails, there are two ways you can print the Ruby objects.
- <%= debug @an_object %>
- <%= @an_array.inspect %>
Assume you got the following variables in the view
- @service – One single service
- @services – An array containing many services
Print it in the view
<p>Debug</p> <%= debug @service %> <div class="aligncenter" style="width:400px;height:0;border-top:4px groove #008000;font-size:0;">-</div> <p>Map</p> <% @services.each do |x| %> <%= x.inspect %><br/> <% end %> <div class="aligncenter" style="width:400px;height:0;border-top:4px groove #008000;font-size:0;">-</div>
Done =)
Reference:

