Class: LanguageRedirectPage
- Inherits:
-
Page
- Object
- Page
- LanguageRedirectPage
- Defined in:
- app/models/language_redirect_page.rb
Instance Method Summary collapse
- #cache? ⇒ Boolean
- #find_by_url(url, live = true, clean = true) ⇒ Object (also: #find_by_path)
- #headers ⇒ Object
- #render ⇒ Object
- #response_code ⇒ Object
Instance Method Details
#cache? ⇒ Boolean
15 16 17 |
# File 'app/models/language_redirect_page.rb', line 15 def cache? false end |
#find_by_url(url, live = true, clean = true) ⇒ Object Also known as: find_by_path
23 24 25 26 27 28 29 30 31 |
# File 'app/models/language_redirect_page.rb', line 23 def find_by_url(url, live=true, clean=true) found = super if (found.nil? || found.is_a?(FileNotFoundPage)) && location_map.values.all? {|target| clean_url(url) !~ Regexp.new(target) } self else found end end |
#headers ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/models/language_redirect_page.rb', line 3 def headers { 'Status' => "301 Redirect", 'Location' => location, 'Vary' => "Accept-Language" } end |
#render ⇒ Object
11 12 13 |
# File 'app/models/language_redirect_page.rb', line 11 def render "<html><body>301 Redirect</body></html>" end |
#response_code ⇒ Object
19 20 21 |
# File 'app/models/language_redirect_page.rb', line 19 def response_code 301 end |