productionモードの時だけ実行されるフィルタが必要になり、いつどこで定義するのが良いか調べてみましました。
githubを見て回ったところ、RAILS_ROOT/config/environments/production.rbで、config.after_initializeの中で定義すれば良いみたい。下記のコードで確認できました。1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
config.after_initialize do require 'application' unless Object.const_defined?(:ApplicationController) TicketsController.class_eval do before_filter :start_action, :only => [:index, :search] after_filter :end_action, :only => [:index, :search] def start_action logger.info "action start." end def end_action logger.info "action end." end end end |
Sorry, comments are closed for this article.