-
Notifications
You must be signed in to change notification settings - Fork 2
Multi sites app
Petr Mlčoch edited this page Aug 15, 2022
·
1 revision
- create many
Folio::Sites
, domain should includewww.
- change Folio config to
config.folio_site_is_a_singleton = false
- override
Folio.current_site
, eg:module Folio def self.current_site(request: nil) if Rails.application.config.folio_site_is_a_singleton Folio::Site.instance else raise "request is needed to find correct site" if request.nil? Folio::Site.find_by(domain: request.host) end end end
- models related to site needs column
site_id
andinclude Folio::BelongsToSite
- in app,
current_site
helper returns value of site from request (in controller/view) - in test, use helper
create_and_host_site(key: site_key, attributes: {})
.site_key
is name of specific factory. If it is not presentRails.application.config.folio_site_default_test_factory || :folio_site
are used.