use starts_with? instead of start_with, fixes #253 and #251

This commit is contained in:
Mario Visic 2011-11-27 18:22:00 +11:00
parent 0e5e16c8b4
commit 7f7ed896cf
2 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ module Locomotive
end end
def absolute_url(url) def absolute_url(url)
url.starts_with('/') ? url : "/#{url}" url.starts_with?('/') ? url : "/#{url}"
end end
end end

View File

@ -9,7 +9,7 @@ module Locomotive
def call(env) def call(env)
path = env['PATH_INFO'] path = env['PATH_INFO']
if !path.starts_with('/admin/') && (match = path.match(%r{(.+)/$})) if !path.starts_with?('/admin/') && (match = path.match(%r{(.+)/$}))
response = Rack::Response.new response = Rack::Response.new
response.redirect(match[1], 301) # moved permanently response.redirect(match[1], 301) # moved permanently
response.finish response.finish