This
<%= debug @freebox %>
brings
--- !ruby/object:Freebox
attributes:
name: Shiny Skateboards
home_page:
country: USA
id: "1"
street_and_house: Everyone's Lane
phone: "36365"
user_id: "1"
opening_hours: Mon-Fri 10am-8pm, Sat 10am-6pm
city_and_zip: Detroit
state: Michigan
That's OK, but the format is different than what I'm used to,
and nil is not shown. So in config/environments/development.rb
I added
require 'pp', and in
app/helpers/application_helper.rb I have
def pp_debug(obj)
'<pre>' +
h(obj.pretty_inspect) +
'</pre>'
end
Now, this
<%= pp_debug @freebox %>
brings
#<Freebox:0x410347c4
@attributes=
{"name"=>"Shiny Skateboards",
"home_page"=>nil,
"country"=>"USA",
"id"=>"1",
"street_and_house"=>"Everyone's Lane",
"phone"=>"36365",
"user_id"=>"1",
"opening_hours"=>"Mon-Fri 10am-8pm, Sat 10am-6pm",
"city_and_zip"=>"Detroit",
"state"=>"Michigan"}>