#86 Logging Variables
Have you ever wanted to easily log all variables? Now you can by using some advanced Ruby concepts as shown in this episode.
- Download:
- mp4Full Size H.264 Video (8.71 MB)
- m4vSmaller H.264 Video (6.21 MB)
- webmFull Size VP8 Video (18.8 MB)
- ogvFull Size Theora Video (11.6 MB)
so I've learned one more thing in 2007 about ruby and rails, just great, thx!
thx 4 all in this year and a happy new year 2008 to Ryan and to all those who are watching this!
It is hard to thank you enough for these wonderful screencasts. Thanks and have a wonderful 2008!
I was just looking for something on this subject last night! One more awesome screencast. Keep it up!
that was sick, nice script-foo. i have always wanted to do what eval does, just didnt know how to do it or what to call it.
Nice episode that demonstrates Ruby knowledge and skills. As Ruby is a great language for DSL, it has great features to expand Rails. Just show us more like that.
Thanks and Happy New year!
Thanks a ton for your screencasts!
Does this only apply to Rails 2.0 or does this also work in 1.8.6?
@Eric, this should work in Rails 1.2 as well. The only difference is the file in "initializers" directory won't be loaded automatically. You'll have to either manually load it or place it directly in environment.rb.
Ah..nice. Thanks, but I'm getting this error on my setup:
logger_additions.rb:1: warning: toplevel constant Logger referenced by ActiveRecord::Base::Logger
I removed the line:
logger = ActiveRecord::Base.logger
and changed to:
def RAILS_DEFAULT_LOGGER.debug_variables(bind)
...
end
Hope it'll help others with similar issue.
wow, nice screencast. I love the way you can hack ruby.
I'm using your name because I wondered wether its possible without being the admin, sorry. Just being curious!
[admin edit] Yep, its possible - probably something I should fix...
Great podcast. I have been following your podcast for a few weeks now and actually went back and watched all the previous ones. Great job!
I was able to implement the variable logging pretty easily. A couple quick random thoughts that are most likely stupid.
The idea is to quickly view variables but it would be really helpful if they were organized in someway. Maybe by data structure or if they are empty or not. This way a developer could get used to looking in the same place for nil values , hashes, arrays..etc. Dumb thought?
Greate screencast. I want to quickly learn Rails ? So I need a help. Please contact me ?
If you're getting a bunch of unnecessary instance variables such as
@_cookies or @url
Then you can filter out the responses you don't want like this:
http://pastie.org/336813
cool post with impressive content.