ruby on rails - Why Destroy Action is NOT being fired? -


i using rails 3 , trying see why destroy action not being fired! html fired defined follows:

  <%= link_to "delete", :action => "destroy", :id => article, :method => :delete, :confirm => "are u sure?" %> 

and here articlescontroller:

def destroy      @article = article.find(params[:id])      @article.destroy       respond_to |format|       format.html { redirect_to articles_url }     end    end 

when click on "delete" link takes me show action. not sure why that?

your link_to should this:

<%= link_to "delete", @article, :method => :delete, :confirm => "are u sure?" %> 

this generate correct url article , go destroy action.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -