开发者

Rails on windows destroy

开发者 https://www.devze.com 2023-02-14 09:31 出处:网络
I am using rails 3 on windows. I used scaffolding to create a \"party\" MVC but the destroy action does not work for some reason and redirects instead to the show page.

I am using rails 3 on windows. I used scaffolding to create a "party" MVC but the destroy action does not work for some reason and redirects instead to the show page.

View:

<td><%= link_to 'Destroy', party, :confirm => 'Are you sure?', :method => :delete %></td>

Controller:

def destroy

@开发者_运维问答party = Party.find(params[:id]) @party.destroy

respond_to do |format|
  format.html { redirect_to(parties_url) }
  format.xml  { head :ok }
end

end

Whats wrong?


Make sure you have the javascript/csrf tags in your layout:

<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>

(See Delete link sends "Get" instead of "Delete" in Rails 3 view)

0

精彩评论

暂无评论...
验证码 换一张
取 消