Module: DomainRouting::RoutingAdditions
- Included in:
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/domain_routing/routing_additions.rb
Instance Method Summary collapse
- #secure_redirect(route) ⇒ Object
- #with_domain ⇒ Object
- #with_domain_or_subdomain ⇒ Object
- #with_ssl ⇒ Object
- #with_subdomain ⇒ Object
- #without_domain ⇒ Object
- #without_domain_or_subdomain ⇒ Object
- #without_ssl ⇒ Object
- #without_subdomain ⇒ Object
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_domain ⇒ Object
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_subdomain ⇒ Object
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_ssl ⇒ Object
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_subdomain ⇒ Object
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_domain ⇒ Object
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_subdomain ⇒ Object
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_ssl ⇒ Object
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_subdomain ⇒ Object
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 |