Sha256: be7f329e0b946738a900394209b6bb2cd8629ab3df11eea865ed99b874c85e23

Contents?: true

Size: 670 Bytes

Versions: 146

Compression:

Stored size: 670 Bytes

Contents

module MultiSite::ApplicationControllerExtensions

  def current_site
    Page.current_site
  end

  def current_site=(site=nil)
    Page.current_site = site
  end

  # this is overridden in Admin::ResourceController to respond correctly
  
  def sited_model?
    false
  end


  def set_site
    true if self.current_site = discover_current_site
  end

  # chains will attach here

  def discover_current_site
    site_from_host
  end

  # and add more ways to determine the current site

  def site_from_host
    Site.find_for_host(request.host)
  end

  def self.included(base)
    base.class_eval {
      helper_method :current_site, :current_site=
    }
  end

end

Version data entries

146 entries across 146 versions & 2 rubygems

Version Path
trusty-cms-6.0.3 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-6.0.2 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-6.0.1 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.6.1 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-6.0.0 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.6.0 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.9 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.8 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.7 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.6 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.5.1 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5.1 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.5 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.4.4 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.4.3 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.4.2 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.4.1 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.4.0 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.3.9 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb
trusty-cms-5.3.8 vendor/extensions/multi-site-extension/lib/multi_site/application_controller_extensions.rb