Reputation: 13839
Every new user must accept the EULA in order to use the service provided by my RoR application, so when the user first time logs in to my website, s/he has to accept the EULA, if s/he does NOT want to accept, s/he can just logout, so:
I have a before_filter
in my ApplicationController
with an :except
action:
before_filter :check_eula, :except => [:destroy]
And there is link on my EULA page:
<%= link_to('Logout', destroy_user_session_path, :method => :delete, :class => link_class) %>
And I'm using Devise: https://github.com/plataformatec/devise/blob/master/lib/devise/rails/routes.rb
destroy_user_session DELETE /users/sign_out {:controller=>"devise/sessions", :action=>"destroy"}
The problem is that, it seems the :check_eula
is still called when the user clicks the "Logout" link without accepting the EULA.
Upvotes: 1
Views: 3601
Reputation: 13839
I don't know why the following is working, but here is the solution:
In config/application.rb
:
config.to_prepare do
# ...
Devise::SessionsController.skip_before_filter :check_eula, :only => [:destroy]
end
Reference:
How to skip a before_filter for Devise's SessionsController?
Upvotes: 3