Skip to content

Instantly share code, notes, and snippets.

@nordringrayhide
Forked from alexagui/ruby_debug_pow.markdown
Created December 10, 2011 06:57
Show Gist options
  • Save nordringrayhide/1454745 to your computer and use it in GitHub Desktop.
Save nordringrayhide/1454745 to your computer and use it in GitHub Desktop.
How to Ruby Debug with Pow

How to Ruby Debug with Pow

Below are steps I followed to get ruby debugger ruby-debug running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/

1) Update your Gemfile

Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:

group :development do
  gem 'ruby-debug19', require: 'ruby-debug'
end

2) Update development environment

Add the following to config/environments/development.rb

# Always run remote debugger in development mode.
require 'ruby-debug'
Debugger.start_remote
Debugger.settings[:autoeval] = true
puts "=> Debugger enabled"

3) In terminal connect to RDebug’s server with:

rdebug -c

4) Update your code with debugger interrupt call

def create
  @post = Post.find(params[:post_id])
  debugger
  @comment = @post.comments.create(params[:comment])
  redirect_to post_path(@post)
end

References

@macmartine
Copy link

I have been trying this for hours and everything seems ok except that breakpoints are never hit. Do you have any idea what would cause this? I've restarted the server and machine several times. Here's a post about my issue http://stackoverflow.com/questions/8996498/ruby-debug-with-pow-breakpoints-never-hit Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment