Rails include YAML.rb somewhere, so we have access to the to_yaml method on any object.
To see what’s in an object, define a helper:
def dump(object) "<pre>" << object.to_yaml << "</pre>" end
Then in your rhtml, you can do a:
<%= dump @person %> <%= dump @person.methods.sort %>
Which may yield something like:
--- &id001 !ruby/object:Person
attributes:
name: Superman
city: Smallville
zip: "12345"
street1: PO Box 123
street2: 123 Somewhere
id: 1
state: KS
errors: !ruby/object:ActiveRecord::Errors
base: *id001
errors: {}
phones:
- !ruby/object:Phone
attributes:
id: "1"
phone: "6203423065"
person_id: "1"
- !ruby/object:Phone
attributes:
id: "2"
phone: "6204811303"
person_id: "1"