module ActionDispatch::Routing::Mapper::HttpHelpers
def delete(*args, &block)
def delete(*args, &block) map_method(:delete, *args, &block) end
def get(*args, &block)
def get(*args, &block) map_method(:get, *args, &block) end
def map_method(method, *args, &block)
def map_method(method, *args, &block) options = args.extract_options! options[:via] = method args.push(options) match(*args, &block) self end
def post(*args, &block)
def post(*args, &block) map_method(:post, *args, &block) end
def put(*args, &block)
def put(*args, &block) map_method(:put, *args, &block) end
def redirect(*args, &block)
def redirect(*args, &block) options = args.last.is_a?(Hash) ? args.pop : {} path = args.shift || block path_proc = path.is_a?(Proc) ? path : proc { |params| path % params } status = options[:status] || 301 lambda do |env| req = Request.new(env) params = [req.symbolized_path_parameters] params << req if path_proc.arity > 1 uri = URI.parse(path_proc.call(*params)) uri.scheme ||= req.scheme uri.host ||= req.host uri.port ||= req.port unless req.standard_port? body = %(<html><body>You are being <a href="#{ERB::Util.h(uri.to_s)}">redirected</a>.</body></html>) headers = { 'Location' => uri.to_s, 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s } [ status, headers, [body] ] end end