Debug with Rails

77 Views Asked by At

Up: If it's true:

"You wan to display a very complex object, you have a very complex result."

How I could make easier the output?


I wanna pretty print @_controller and what I see:

  1. <%= debug @_controller %> enter image description here

2.<%= simple_format @_controller.to_yaml %> error: "can't dump anonymous module: #"

  1. <%= @_controller.inspect %>

enter image description here

  1. <%= raw ap(@_controller) %> enter image description here

Is there are way to pretty print this object (@_controller)?

Like echo '<pre>';print_r($object);echo '</pre>'; in php?

Thx a lot!!!

2

There are 2 best solutions below

0
On BEST ANSWER

I found an answer by myself, its ok for me to print controller.methods and controller.instance_variables

Thx a lot!

1
On

Rails' <%= a.inspect %> is the "equivalent" of PHP' print_r(a).

You wan to display a very complex object, you have a very complex result.