形式我已經在我的routes.rb
生成經過多個參數
map.diff 'posts/:id/diff/:from/:to', :controller => "posts",
:action => "diff", :conditions => { :method => :get }
下在我看來,文件我有以下。
- form_tag(diff_path(), :method => :get) do
= text_field_tag(:from, "")
= text_field_tag(:to, "")
= hidden_field_tag(:id, @post.id)
= submit_tag("Submit")
我想生成一個表格,提交像「http://example.com/posts/3/diff/13/18」,但它失敗。我怎樣才能製作這樣的表格?
我需要傳遞參數diff_path(),但我不知道該怎麼做。我甚至不知道這是否可能與form_tag
。
錯誤消息:
diff_url failed to generate from {:action=>"diff", :controller=>"posts"} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: ["posts", :id, "diff", :from, :to] - are they all satisfied?
你會得到什麼樣的錯誤信息? – theIV 2010-06-28 00:25:16
感謝您的問題。我在我的問題中添加了錯誤消息。 – 2010-06-28 00:28:12
這實際上產生了什麼HTML?這可能有助於診斷問題 – 2010-06-28 00:37:52