fb2b4d8a8a
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
27 lines
918 B
Ruby
27 lines
918 B
Ruby
# Be sure to restart your server when you modify this file.
|
|
|
|
module ActionDispatch
|
|
module Session
|
|
class SlugCookieStore < CookieStore
|
|
alias orig_set_cookie set_cookie
|
|
|
|
def set_cookie(request, session_id, cookie)
|
|
if script_name = FoodsoftConfig[:script_name]
|
|
path = request.original_fullpath[script_name.size..-1]
|
|
slug = path.split('/', 2).first
|
|
return if slug.blank?
|
|
|
|
cookie[:path] = script_name + slug
|
|
end
|
|
orig_set_cookie request, session_id, cookie
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Rails.application.config.session_store :slug_cookie_store, key: '_foodsoft_session'
|
|
|
|
# Use the database for sessions instead of the cookie-based default,
|
|
# which shouldn't be used to store highly confidential information
|
|
# (create the session table with "rails generate session_migration")
|
|
# Foodsoft::Application.config.session_store :active_record_store
|