Class: LanguageRedirectPage

Inherits:
Page
  • Object
show all
Defined in:
app/models/language_redirect_page.rb

Instance Method Summary collapse

Instance Method Details

#cache?Boolean

Returns:

  • (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

#headersObject



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

#renderObject



11
12
13
# File 'app/models/language_redirect_page.rb', line 11

def render
  "<html><body>301 Redirect</body></html>"
end

#response_codeObject



19
20
21
# File 'app/models/language_redirect_page.rb', line 19

def response_code
  301
end