私の application_controller.rb コードは次のとおりです。
class ApplicationController < ActionController::Base# Prevent CSRF attacks by raising an exception.#For APIs, you may want to use: null_session instead.
protect_from_forgery
before_filter: set_current_user
rescue_from ActionController::RoutingError, with: : render_error
def render_error
p "**************************************"
end
def set_current_user
User.current_user = current_user
end
end
ここでヒットしようとすると、home/xyz
この例外はキャプチャされているはずですが、制御がrender_error
メソッドに来ることはありません。この例外を捕捉するために私がしなければならないことは他にありますか? または、Rails 4.2で利用できるより良い方法がある場合、誰かが私がGemを試したことについて私を案内してくれますException Notificaiton
が、それもうまくいかないようです. 注:開発環境を使用しています。
私のエラーログ:
Started GET "/qweq"
for 172.24.106.197 at 2016 - 09 - 07 16: 03: 01 + 0530
ActionController::RoutingError(No route matches[GET]
"/qweq"):
actionpack(4.2.6) lib / action_dispatch / middleware / debug_exceptions.rb: 21: in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `
call '
railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
railties(4.2.6) lib / rails / rack / logger.rb: 20: in `block in call'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `
block in tagged '
activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport(4.2.6) lib / active_support / tagged_logging.rb: 68: in `tagged'
railties (4.2.6) lib/rails/rack/logger.rb:20:in `
call '
actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack(1.6.4) lib / rack / methodoverride.rb: 22: in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `
call '
activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack(1.6.4) lib / rack / lock.rb: 17: in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `
call '
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties(4.2.6) lib / rails / engine.rb: 518: in `call'
railties (4.2.6) lib/rails/application.rb:165:in `
call '
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack(1.6.4) lib / rack / content_length.rb: 15: in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `
service '
/home/883562/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service' / home / 883562 / .rvm / rubies / ruby - 2.1.4 / lib / ruby / 2.1.0 / webrick / httpserver.rb: 94: in `run'
/home/883562/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/webrick/server.rb:295:in `
block in start_thread '