module ActionDispatch::Routing::Mapper::HttpHelpers
Public Instance Methods
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_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_www()
click to toggle source
# File lib/action_dispatch/routing/mapper/http_helpers.rb, line 8 def ensure_www ensure_subdomain 'www' end