I\'m working on a RoR app with Devise. I want to let clients send a request to the server to see how much time is left until the user on the client is automatically logged o
The two leading answers of prepending a request.env["devise.skip_trackable"] = true
action did not work for me initially.
It seems that this only works if you are using the "classic" authenticate_user!
before action, and not when using authenticated routes. If you are using authenticated routes in your config/routes.rb
, such as:
authenticate :user do
resources :some_resources
end
Prepending the action does not seem to affect the Devise chain in time, so you should comment out the authenticate
block out, use an authenticate_user!
before action instead in your app/controllers/application_controller.rb
, and add a prepend action that sets skip_trackable
to true in a specific controller.