ruby-debug with Ruby 1.9.3?

前端 未结 9 1321
甜味超标
甜味超标 2020-11-28 04:41

I just updated to Ruby 1.9.3p0 and Rails 3.1.1. Now when I try to launch the server, it complains that I should install ruby-debug, even though it\'s already in

9条回答
  •  被撕碎了的回忆
    2020-11-28 05:37

    Someone else posted in a comment to try Pry, which is what I did. This is what's necessary for Rails:

    # Gemfile
    gem 'pry-rails'
    
    
    # In your Rails Project where you want a 'debugger'
    
    puts 'i want to insert some code between this'
    
    binding.pry
    
    puts 'and this'
    

    Immediately after installing I notice my .irbrc doesn't load, so I don't get pretty console output. I also added this to my '~/.pryrc'

    # setting up pry to have irb helpers like reload!
    if defined?(Rails) && Rails.env
      extend Rails::ConsoleMethods
    end
    

    Pry has some nice features that I've wanted to check out, and I may yet return to ruby-debug once there's a simple way to integrate it into a Rails project for Ruby 1.9.3. I can run the curl command from the other answers, but this is something I'll have to point my teammates to for our Rails project, so it doesn't scale well IMO.

提交回复
热议问题