# Debugging

**URL:** <https://www.ruby-forum.com/t/debugging/109642>\
**Category:** Rails\
**Created:** [July 17, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/debugging/109642 "2007-07-17T15:19:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Gower](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eada6e/32.png) [@Paul\_Gower](https://www.ruby-forum.com/u/Paul_Gower)\
**Post date:** [July 17, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/debugging/109642/1 "2007-07-17T15:19:19Z")

</div>

Hi all,  
I am trying to come up with a good way to handle the debugging data  
that I am generating in my app. I am aware of logger and am using it  
but I also want to be able to see selected object values in the  
browser window. Rather than just using lots of put statements in my  
view I want to try and use a debug hash or object to store all the  
debug data so that i can then render it on the page in a nice way.

Unfortunately I cannot find any built in object that would suit my  
needs and I cannot work out how to make an object available both in  
the controller and the view. Ideally I want the object to be  
available in controllers and views without having to explicitly  
declare it in each one.

I had thought about declaring a new model without a database table  
and then adding the methods I want to that model, but that seemed a  
bit to hackish. Is there another way of doing this?

Any help would be much appreciated.

Thanks  
Paul

---

<div class="post-metadata">

**Author:** ![Paul\_Gower](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eada6e/32.png) [@Paul\_Gower](https://www.ruby-forum.com/u/Paul_Gower)\
**Post date:** [July 17, 2007, 4:24pm UTC](https://www.ruby-forum.com/t/debugging/109642/2 "2007-07-17T16:24:28Z")

</div>

Paul Gower wrote:

> I am trying to come up with a good way to handle the debugging data  
> that I am generating in my app. I am aware of logger and am using it  
> but I also want to be able to see selected object values in the  
> browser window. Rather than just using lots of put statements in my  
> view I want to try and use a debug hash or object to store all the  
> debug data so that i can then render it on the page in a nice way.

You can run just one unit test like this:

ruby test/functional/my\_controller\_test.rb -n test\_my\_case

That way, no matter how much spew your code has, you only see it for  
one isolated test case.

BTW excessive debugging spew is a sign of poor test cases, so you  
might want to just work there for a while before fixing this specific  
bug.

–  
Phlip  
[http://www.oreilly.com/catalog/9780596510657/](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax
