Help with destroy method - newbie

Hello:

I have a destroy method in my controller - pretty standard:

def destroy
@goal = Goal.find(params[:id])
respond_to do |format|
format.html { redirect_to goals_url }
format.xml { head :ok }
end
end

And then I have a listing view which has the destroy method in the view

  • also pretty standard:

<%= link_to ‘Delete’, { :action => ‘destroy’, :id => goal }, :confirm
=> ‘Are you sure?’, :post => true %>&nbsp|&nbsp

where the id = goal id - no problem retreiving that, becuase i see it
in my URL:

[myurl.com]/goals/13

but this is called, I get an error:

Unknown action

No action responded to 13

How can this be the case when the destroy method is correctly being
referenced in my view?

Thank you very much in advance for any help you can provide.

Mike

It has to be url/controller_name/action_name/id … so in your case it
should be like url/goals/destroy/13 … hope this helps …

end
[myurl.com]/goals/13

but this is called, I get an error:

Unknown action

No action responded to 13

How can this be the case when the destroy method is correctly being
referenced in my view?

Look at your routes file… somewhere you have a route that is matching
this and messing you up. Rails thinks that ‘13’ is the action.
Something
in your routes is making the action not get picked up.