Skip to content

Instantly share code, notes, and snippets.

@danielfone
Last active May 20, 2020 13:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielfone/c8ab593c326a8052651c to your computer and use it in GitHub Desktop.
Save danielfone/c8ab593c326a8052651c to your computer and use it in GitHub Desktop.
Monkey-patch to prevent Devise from causing CookieOverflow errors
# config/initializers/devise_safe_store_location.rb
module SafeStoreLocation
MAX_LOCATION_SIZE = ActionDispatch::Cookies::MAX_COOKIE_SIZE / 2
def store_location_for(resource_or_scope, location)
super unless location && location.size > MAX_LOCATION_SIZE
end
end
Devise::FailureApp.include SafeStoreLocation
@danielfone
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment