lib/fozzie/rails/middleware.rb in fozzie-0.0.20 vs lib/fozzie/rails/middleware.rb in fozzie-0.0.21
- old
+ new
@@ -11,24 +11,27 @@
def generate_key(env)
path_str = env['PATH_INFO']
return nil unless path_str
begin
- routing = (rails_version == 3 ? ::Rails.application.routes : ::ActionController::Routing::Routes)
+ routing = routing_lookup
path = routing.recognize_path(path_str)
stat = [path[:controller], path[:action], "render"].join('.')
stat
- rescue ActionController::RoutingError => exc
+ rescue => exc
S.increment "routing.error"
nil
- rescue => exc
- nil
end
end
+ def routing_lookup
+ (rails_version == 3 ? ::Rails.application.routes : ::ActionController::Routing::Routes)
+ end
+
def rails_version
::Rails.version.to_i
end
end
+
end
end
\ No newline at end of file