:except not working in before_filter in application controller. Routing problem?

帅比萌擦擦* 提交于 2019-11-30 17:48:55

The :except option takes action names, not url parts. Here's what you should do instead:

class ApplicationController < ActionController::Base
  before_filter :update_activity_time
  ...
end

Then, in sessions_controller.rb:

class SessionsController < ApplicationController
  skip_before_filter :update_activity_time, :only => [:new, :destroy]
  ...
end

You don't want to put the :except in ApplicationController because, if you did, the new and destroy actions for every one of your app's controllers wouldn't update the activity time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!