I have several links I'm trying to create to either perform custom controller methods or the destroy action. I'm using jquery via the jquery-rails gem and have ran the generator and seems to be including properly:
<script type="text/javascript" src="/javascripts/jquery.js?1312255663">
<script type="text/javascript" src="/javascripts/rails.js?1312407526">
<script type="text/javascript" src="/javascripts/jquery.min.js?1312255664">
<script type="text/javascript" src="/javascripts/application.js?1312256996">
Here is an example of a link using :method => :delete:
<%= link_to "Delete", list_path(@list), :method => :delete, :confirm => "Are you sure?" %>
with my routes.rb:
resources :lists
I think maybe the issue might be with my controller methods, but I still don't understand why it would be rendering the show action, here's my destroy method for the above link/controller.
def destroy
@list = current_user.lists.find(params[:id])
@list.active = false
@list.save
if @list.save
redirect_to root_path, :notice => "List '#{@list.name}' deleted."
else
render :action => 'edit'
end
end
Is there anything obvious that I'm missing here, specifically with the jquery as that's where a lot of people seem to have this same issue.