KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to catch unknown action error in Rails 3, that shows "Unknown Action" error on development and the 404.html on production. I tried putting this rescue_from handler on my ApplicationController (and also on an actual controller, just in case) but I still see the ugly error. I have custom stuff on the 404, and it can't be plain .html file. My route: match '/user/:id/:action', controller: 'users' The URL I'm accessing: /user/elado/xxx The rescue_from code: rescue_from AbstractController::ActionNotFound, :with => :action_not_found def action_not_found render text: "action_not_found" end The error in the browser: Unknown action The action 'xxx' could not be found for UsersController And in the console: Started GET "/user/elado/xxx" for 127.0.0.1 at 2011-09-07 19:16:27 -0700 AbstractController::ActionNotFound (The action 'xxx' could not be found for UsersController): Tried also rescue_from ActionController::UnknownAction . Any suggestions? Thanks!
Tags (comma-separated)
Save Edits
Cancel