The application can behave differently based on the request URL by presenting a diferent 'site' experience to the end-user, who may also choose from the locales (language presentations) that the site supports.The Session manages this: it's a PORO plus some Trailblazer operations. It keeps state for the current request including current user, the Rails session and site and locale selections. It's established with a
Session::Create operation before processing a request.
The Session does not persist across requests, except for data placed in its persistent
store, for which the Rails session is used (but another Hash-like object could be used instead).
The Session is established in the ApplicationController:
before_action do Session::Create.reject(params.merge(store: session, host: request.host, preferred_locales: get_preferred_locales_from_http_request)) do |op|