4 ms·
In rails you can just do: class ApplicationController < ActionController::Base around_filter :pry_rescue if Rails.env == 'development' def pry
by cirwin 14y ago
In 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?