Skip to content
This repository

Add http method to RoutingError message #299

Closed
wants to merge 1 commit into from

3 participants

Richard Schneeman Mattt Thompson Aaron Patterson
Richard Schneeman
Collaborator

Currently ActionController::RoutingError message will alert the user of a bad path but not the method.

No route matches "/join"

This patch adds the method used to call the url for debugging.

No route matches [POST] "/join"

By showing the method used, certain routing problems are easier to find, especially for a new rails user who is not as familliar with restful routing.

Mattt Thompson
mattt commented April 22, 2011

+1
Every now and then, this will trip me up. I'll be all "no way, I totally defined tha—oh, I'm dumb", except this internal monologue will transpire over, like, 20 minutes.

Aaron Patterson
Owner

Applied, thanks!

Aaron Patterson tenderlove closed this April 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 22, 2011
Richard Schneeman show http method in routing error message 15b796b
This page is out of date. Refresh to see the latest.
2  actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -50,7 +50,7 @@ def call(env)
50 50
         # Only this middleware cares about RoutingError. So, let's just raise
51 51
         # it here.
52 52
         if headers['X-Cascade'] == 'pass'
53  
-           raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}"
  53
+           raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
54 54
         end
55 55
       rescue Exception => exception
56 56
         raise exception if env['action_dispatch.show_exceptions'] == false
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.