Rails on windows destroy
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)
精彩评论