Debugging

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

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.