gonzalo-bulnes/simple_token_authentication — pull request #51 by adamniedzielski (2014-04-07 16:55:19+00:00)
Title: sign_in_count updated on each request which requires authentication

To start with - thanks for great gem!

I've followed the README and managed to get everything working. My use case is as follows:
1. Send email and password to my customized ```SessionsController#create```
2. Take authentication_token which is present in successful response
3. Pass this authentication_token and email in headers of each subsequent request.

When ```SessionsController#create``` is called I expect ```sign_in_count```, ```last_sign_in_at```, ```current_sign_in_at``` to be updated and this is working fine.

However, these fields are also updated **during each request which requires authentication**. This leads to database updates even on GET requests, takes time and in my opinion is simply an incorrect behaviour.

I think that this line: https://github.com/gonzalo-bulnes/simple_token_authentication/blob/master/lib/simple_token_authentication/acts_as_token_authentication_handler.rb#L61

is triggering this callback: https://github.com/plataformatec/devise/blob/master/lib/devise/hooks/trackable.rb

Am I doing everything OK? Or maybe this is an expected behaviour. I see a possibility of workaround here: https://github.com/plataformatec/devise/issues/953