lynndylanhurley/devise_token_auth — pull request #93 by troggy (2014-12-26 05:22:41+00:00)
Title: Make default Warden scope changeable

Hi!

I have been using devise_token_auth successfully in my app until I need to change model name from User to Account. I reconfigured all the things as needed, but my application started throwing CookieOverflow exception:
````
ActionDispatch::Cookies::CookieOverflow (ActionDispatch::Cookies::CookieOverflow):
actionpack (4.1.6) lib/action_dispatch/middleware/cookies.rb:529:in `[]='
actionpack (4.1.6) lib/action_dispatch/middleware/session/cookie_store.rb:110:in `set_cookie'
````
In debugger I see that the whole Account object being put to session under ``warden.user.user.key`` which results to cookie overflow. If model is User than only user id is kept in session. I've noticed that gem always uses :user scope (which forms that ``warden.user.user.key`` name) when talking to Devise and when I change scope name to :account error is gone and everything works as expected. So I decided to make scope configurable

Please note that I'm kind of new to Rails, so I may be tackling the problem from the wrong angle.