Ruby on Rails
HowtoDebugViews (Version #2)

Debug tools

Rails comes with a debug helper you can use in views:


<%= debug @user %> 

This will produce output like this :


--- !ruby/object:User 
attributes: 
  name: Jane Loe
  username: janeloe
  id: "1"
  password: fc46324eea5eede31c00b9026e5037e162dccda8

Add on helpers

The Rails Plugin to Help Debug Views describes a plugin that makes it easy to add a helper class that will raise a Smarty like popup dumping all assigns, sessions, parameter and flash. The plugin was derived from code available at Snippets.

This is especially useful if you work together with designers who have no idea what kind of information are exported by the controllers in a given view.

category:Howto

Debug tools

Rails comes with a debug helper you can use in views:


<%= debug @user %> 

This will produce output like this :


--- !ruby/object:User 
attributes: 
  name: Jane Loe
  username: janeloe
  id: "1"
  password: fc46324eea5eede31c00b9026e5037e162dccda8

Add on helpers

The Rails Plugin to Help Debug Views describes a plugin that makes it easy to add a helper class that will raise a Smarty like popup dumping all assigns, sessions, parameter and flash. The plugin was derived from code available at Snippets.

This is especially useful if you work together with designers who have no idea what kind of information are exported by the controllers in a given view.

category:Howto