1

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?

1 Answers1

2

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)

Community
  • 1
  • 1
Dylan Markow
  • 123,080
  • 26
  • 284
  • 201