module ActionDispatch::Routing::Mapper::HttpHelpers

Public Instance Methods

ensure_apex()
Alias for: ensure_no_www
ensure_no_www() click to toggle source
# File lib/action_dispatch/routing/mapper/http_helpers.rb, line 2
def ensure_no_www
  ensure_subdomain ''
end
Also aliased as: ensure_non_www, ensure_apex
ensure_non_www()
Alias for: ensure_no_www
ensure_on(environments) click to toggle source
# File lib/action_dispatch/routing/mapper/http_helpers.rb, line 12
def ensure_on(environments)
  environments.each_pair do |env, domain|
    if Rails.env.to_sym == env
      ensure_subdomain domain
    end
  end
end
ensure_subdomain(subdomain, options={}) click to toggle source
# File lib/action_dispatch/routing/mapper/http_helpers.rb, line 20
def ensure_subdomain(subdomain, options={})
  redirector = ::EnsureSubdomain.new( subdomain )
  verbs = options[:via] || [:get, :post, :put, :patch, :delete]
  constraints( redirector ) do
    match '/', to: redirect { |params, request| redirector.to params, request }, via: verbs
    match '/*path', to: redirect { |params, request| redirector.to params, request }, via: verbs
  end
end
Also aliased as: ensure_subdomains
ensure_subdomains(subdomain, options={})
Alias for: ensure_subdomain
ensure_www() click to toggle source
# File lib/action_dispatch/routing/mapper/http_helpers.rb, line 8
def ensure_www
  ensure_subdomain 'www'
end