Reputation: 45941
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :check_session_expiry, :except => :login
How do you exclude a single controller's (the users controller, for example) login action?
Upvotes: 2
Views: 1517
Reputation: 6847
I would just redefine check_session_expiry in your controller to be an empty method.
class UserController < ...
...
private
def check_session_expire
# optional if other actions shall still use the filter
super unless self.action == 'login'
end
end
Upvotes: 2
Reputation: 1787
First, I'm not on a machine with rails to test it, but the following should work:
class UserController < ApplicationController
skip_filter :check_session_expiry, :only => :foo
# following is DEPRECATED as far as I know
#skip_before_filter :check_session_expiry, :only => :foo
def foo
end
end
Upvotes: 5
Reputation: 12759
class ApplicationController < ActionController::Base
before_filter :check_session_expiry
def check_session_expiry
return true if self.class != UsersController && self.action == "login"
# do your thing
end
Upvotes: 2