我如何处理从原始 HTML 形式传入的参数?
载于/views/feeders/index.html.erb:
<form action="/feeders/extract/" method="post" accept-charset="utf-8">
<input type="text" name="url" value="" id="url">
<p><input type="submit" value="submit"></p>
</form>
/控制器/控制器/控制器_控制器.rb
class FeedersController < ApplicationController
def index
@url=params[:url]
end
def show
end
def extract
@url=params[:url]
redirect_to :controller => feeders , :action => show
end
end
在.rb路线中:
root :to => feeders#index
match /feeders/extract/:url => feeders#extract , :via => :post
match /feeders/show/ => feeders#show
我不断得到
Routing Error
No route matches [POST] "/feeders/extract"