No commit activity in last 3 years
No release in over 3 years
Rack::Debug adds a middlerware interface to ruby-debug http://github.com/github/rack-debug
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0
>= 0.10
 Project Readme

NOTE: If you’re using Ruby 1.8.x please use the 1.x series of rack-debug

Install

$ gem install rack-debug

Rails

# config/environments/development.rb
config.gem 'rack-debug'
config.middleware.use 'Rack::Debug'

# RAILS_ROOT/Rakefile
require 'rack-debug/tasks'

Middleware

# add a use line to your builder
require 'rack/debug'
Rack::Builder.new do
  use Rack::Debug
  run MyApp.new
end

# can optionally specify where to put the sockets
use Rack::Debug, :socket_path => '/tmp/rack-debug'

# Rakefile
require 'rack-debug/tasks'

Add breakpoints to your code

@user = User.find(params[:id])
debugger
render :show

Debugging:

# run the rake task,
$ rake debug
Connected.

# refresh a page in your browser, your app will break at debugger statements
(rdb:1) p @user
#<User id: 1, name: "David Dollar", email: "ddollar@gmail.com", created_at: "...", updated_at: "...">

# can specify the socket path
SOCKET_PATH=/tmp/rack-debug rake debug

Meta:

Author/Maintainer: David Dollar

Patches contributed by:
  Bart Teeuwisse

Thanks to:

Rack::Bug for a good example of Rack middleware in Rails
Ben Scofield for making me want to build some Rack middleware