4 ms·
Thanks for this. How would I use it in Rails? Any tips for integration?
by picardo 14y ago
Thanks for this. How would I use it in Rails? Any tips for integration?
- cirwin 14y agoIn rails you can just do: class ApplicationController < ActionController::Base around_filter :pry_rescue if Rails.env == 'development' def pry_rescue Pry::rescue{ yield } end I'm hoping to get a Rack middleware out at some point; which will make this even easier.
- blaines 14y agoHere's a basic middleware... pry_rescue.rb require 'pry/rescue' class PryRescue def initialize(app) @app = app end def call(env) Pry::rescue{ @app.call(env) } end end For rails you need to require the file and use the middleware... application.rb config.middleware.use "PryRescue"
- drewda 14y agoI know this is short and simple, but it still might be nice to wrap up in a gem. Or maybe work into the pry-rails gem?