form_remote_tag不会执行:method =>:put

Ada*_*m T 5 ruby-on-rails

有人能告诉我为什么这是执行POST方法而不是我在ajax请求中指定的PUT方法吗?

<% form_remote_tag(
    :url => contact_url(detail),
    :method => :put,
    :complete => "Element.toggle($('#{form_id}))",
    :success => visual_effect(:shake, "contact-#{detail.id}"),
    :update => "contact-#{detail.id}",
    :html => {:id => form_id, :style => "display:none"}) do %>
Run Code Online (Sandbox Code Playgroud)

生成的输出:

<form action="/contacts/1" id="tag-form-for-1" method="post" onsubmit="new Ajax.Updater('contact-1', '/contacts/1', {asynchronous:true, evalScripts:true, method:'put', onComplete:function(request){Element.toggle($('tag-form-for-1))}, onSuccess:function(request){new Effect.Shake(&quot;contact-1&quot;,{});}, parameters:Form.serialize(this)}); return false;" style="display:none">


<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden" value="7807qAkHN3c1yyZlLoy9Z5pUByviR5az9vtuHHBbVv4=" />
</div>

<input id="tag_list" name="tag_list" size="40" type="text" value="Home Pittsburgh Ginger" />
<input id="form_id" name="form_id" type="hidden" value="tag-form-for-1" />

</form>
Run Code Online (Sandbox Code Playgroud)

Ada*_*m T 4

经过一番闲逛后,我明白了这一点。看来我需要将 :method => :put 调用放在 :html 哈希中。不知道为什么。如果有人可以回答,那将会很有帮助。