attatchment fu - NO DELETE ability

Hi Guys,

I have installed the attatchment_fu plugin and got it working so can upload images to my application. I used Mike Clark's Weblog as a guide. http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu.

I can upload images no problem but there seems to be no way of deleting the images from the articles, and I have been scratching my head all morning as to how to accomplish this.

I created a button on the form page

<%= button_to "Delete Image", { :action => "delete_article_image", :article_image_id => @article.article_image.id } %>

and in my articles controller I created the following method;

def delete_article_image     @article_image = ArticleImage.find(params[:article_image_id])     @article_image.destroy

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

This code does not throw up any errors, but it does not delete the record in the article_images table

Any help would be greatly appreciated

Ive also tried

def delete_article_image     @article = Article.find(params[:id])     @article_image = @article.article_image     @article_image.destroy

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

but it still does not remove the entry from the database.... please help guys

dont worry. i fixed the problem. it was because the button was inside a _form page and so the variables were not passed across