Sha256: dc0e49bc51dd2423b28752bbfecbd65b01e93c7039ea7ca1d1526133720e2c89

Contents?: true

Size: 705 Bytes

Versions: 116

Compression:

Stored size: 705 Bytes

Contents

module MultiSite
  module RouteExtensions

    def self.included(base)
      base.alias_method :recognition_conditions_without_site, :recognition_conditions
      base.alias_method :recognition_conditions, :recognition_conditions_with_site
    end

    def recognition_conditions_with_site
      result = recognition_conditions_without_site
      if site_names = conditions.delete(:site)
        domains = [*site_names].map{ |site| Regexp.compile(::Site.find_by_name(site).domain) }
        conditions[:site] = Regexp.union(*domains)
        result << "conditions[:site] === env[:site]"
      end
      result
    end

  end
end

ActionController::Routing::Route.send :include, MultiSite::RouteExtensions

Version data entries

116 entries across 116 versions & 2 rubygems

Version Path
trusty-cms-3.5.0 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.4.0 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.7 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.6 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.5 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.3 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.2 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.1 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.2.1 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.3.0 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.2.0 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.1.11 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.1.10 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.1.9 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-multi-site-extension-3.1.0 lib/multi_site/route_extensions.rb
trusty-multi-site-extension-3.0.2 lib/multi_site/route_extensions.rb