Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Rack::Debug is middleware that provides a simple interface to ruby-debug. Helps debug apps running in Passenger.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib switch to ruby 1.9.2 by default, release as 2.x
.gitignore
README.rdoc
Rakefile
rack-debug.gemspec

README.rdoc

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
Something went wrong with that request. Please try again.