Monday, 3 September 2012

awesome_print : Ruby printer object

Hi,

awesome_print is the ruby tool to print ruby object with the useful and clear information.

We use 'p' and object.inspect to view the complete object parameters like non-persistent attributes. By using the new 'awesome_print' you can view the complete attributes clearly.

> gem "awesome_print"

In your controller method
> @event = Event.find(params[:id])
> ap @event

 In your console

>   :id => 65,
      :title => "XXXXXXXXXXXXXXXX",
      :description => "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
      :price => 132.0,
      :created_at => XXXXXXXXXXXXXXXXXXXXXXX,
      :updated_at => XXXXXXXXXXXXXXXXXXXXXXX,
      :permalink => "XXXXX".

This will help us on debugging the code.

Thank You,
Uma Mahesh.




No comments:

Post a Comment