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-4.2.3 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.2.2 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.2.1 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.2 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.9 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.8 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.7 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.6 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.5 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.4 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.3 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.2 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.1 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.1.0 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.0.2 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.9.7 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.9.6 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.9.5 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-4.0.1 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb
trusty-cms-3.9.4 vendor/extensions/multi-site-extension/lib/multi_site/route_extensions.rb