Have you ever wanted to easily log all variables? Now you can by using some advanced Ruby concepts as shown in this episode.
# models/product.rb
logger.debug_variables(binding)
# config/initializers/logger_additions.rb
logger = ActiveRecord::Base.logger
def logger.debug_variables(bind)
vars = eval('local_variables + instance_variables', bind)
vars.each do |var|
debug "#{var} = #{eval(var, bind).inspect}"
end
end