Module: DomainRouting::RoutingAdditions

Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/domain_routing/routing_additions.rb

Instance Method Summary collapse

Instance Method Details

#secure_redirect(route) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/domain_routing/routing_additions.rb', line 51

def secure_redirect(route)
  ssl = redirect do |_, request|
    "https://#{request.host_with_port}#{request.fullpath}"
  end

  if route == :root
    root :to => ssl
  else
    match route, :to => ssl
  end
end

#with_domainObject



3
4
5
6
7
# File 'lib/domain_routing/routing_additions.rb', line 3

def with_domain
  constraints DomainRouting::DomainConstraints do
    yield
  end
end

#with_domain_or_subdomainObject



27
28
29
30
31
# File 'lib/domain_routing/routing_additions.rb', line 27

def with_domain_or_subdomain
  constraints DomainRouting::DomainOrSubdomainConstraints do
    yield
  end
end

#with_sslObject



39
40
41
42
43
# File 'lib/domain_routing/routing_additions.rb', line 39

def with_ssl
  constraints DomainRouting::SSL do
    yield
  end
end

#with_subdomainObject



15
16
17
18
19
# File 'lib/domain_routing/routing_additions.rb', line 15

def with_subdomain
  constraints DomainRouting::SubdomainConstraints do
    yield
  end
end

#without_domainObject



9
10
11
12
13
# File 'lib/domain_routing/routing_additions.rb', line 9

def without_domain
  constraints DomainRouting::Negated::DomainConstraints do
    yield
  end
end

#without_domain_or_subdomainObject



33
34
35
36
37
# File 'lib/domain_routing/routing_additions.rb', line 33

def without_domain_or_subdomain
  constraints DomainRouting::Negated::DomainOrSubdomainConstraints do
    yield
  end
end

#without_sslObject



45
46
47
48
49
# File 'lib/domain_routing/routing_additions.rb', line 45

def without_ssl
  constraints DomainRouting::Negated::SSL do
    yield
  end
end

#without_subdomainObject



21
22
23
24
25
# File 'lib/domain_routing/routing_additions.rb', line 21

def without_subdomain
  constraints DomainRouting::Negated::SubdomainConstraints do
    yield
  end
end