Git Product home page Git Product logo

rack-debug's Introduction

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: "[email protected]", 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

rack-debug's People

Contributors

ddollar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.