Sha256: fea364c147d36fa75a516464b92c6dcc373a79b96968b808537a46cf91b62a87
Contents?: true
Size: 430 Bytes
Versions: 7
Compression:
Stored size: 430 Bytes
Contents
module Rack::App::InstanceMethods::RedirectTo def redirect_to(url, params={}) if params.empty? url = [url, request.env['QUERY_STRING']].join('?') unless request.env['QUERY_STRING'].empty? else query_string = Rack::App::Utils.encode_www_form(params.to_a) url = [url, query_string].join('?') end response.status = 301 response.headers.merge!({'Location' => url}) finish! end end
Version data entries
7 entries across 7 versions & 1 rubygems