I'm using the switch_user
gem to have the possibility of changing to another user. However, I want to be able to set or delete cookies when switching to a user. I've not been able to do so, and the documentation on switch_user
doesn't mention this. Perhaps it's got more to do with my authentication gem, authlogic
(in the switch_user
configuration file you have to specify which authorization provider you're using), but I don't know. Any ideas? Thanks!
Asked
Active
Viewed 93 times
0

sauronnikko
- 4,665
- 5
- 31
- 47
1 Answers
0
It would be a better choice to store the information in the session instead of cookie because of cookie overflow, as there is a 4KB limit.
More information about this can be found here: Cookie overflow in rails application?
Another approach would be using the rack session: http://pivotallabs.com/fast-user-switching-with-devise/
-
I will try to be careful about cookie overflow. Let's assume I store the information in the session. I still can't find a way to do it when switching a user – sauronnikko Feb 27 '14 at 00:47
-
then you would have to play around with authlogic, example here: http://stackoverflow.com/questions/3162867/how-can-i-get-authlogic-to-use-the-rails-session-instead-of-its-own-cookie – jamesy829 Feb 27 '14 at 00:59
-
That example is good, but only to avoid creating the default Authlogic cookie. I want to retain it and also add additional cookies – sauronnikko Feb 27 '14 at 19:10