Destroy action not being invoked

This is my index:

<td><%= link_to 'Remove', user,
    :class => "list-actions", :confirm => 'Are you sure?',
    :method => :delete %></td>

And this is my controller:

def destroy
@user = User.find(params[:id])
@user.destroy

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

end

For some reason, when I click on the ‘Remove’ link, it directs me to the
‘Show’ action and does not destroy the item… strange ??

Thanks

Hi Justin,

Justin To wrote:

For some reason, <…>

The reason would be found in routes.rb. You can experiment, to good
effect,
with script/console.

HTH,
Bill

Quoting Justin To [email protected]:

@user = User.find(params[:id])
@user.destroy

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

end

For some reason, when I click on the ‘Remove’ link, it directs me to the
‘Show’ action and does not destroy the item… strange ??

The delete action/method does not invoke the destroy method. If you
want
destroy, put it in the link. Unless you explicitly it in
config/routes.rb.

HTH,
Jeffrey