Remove file_column image in a form?

Xavier Guardiola wrote:

The thing is that I want to let the user delete an image he might have
uploaded before he presses the submit button. Is that possible? For what
I've read, the way to delete the image is to set projecte.image=nil
before a project.save (which is done when the form is submitted). How
could I let the user do that before the submit? Any ideas would be
appreciated!

I generally put a checkbox on the form (a normal checkbox not tied to the model or anything. I.E.

<%= check_box_tag 'remove_image' %>

Then in my "update" action I put the following:

@project = Project.find params[:id]
@project.attributes = params[:project]
@project.image = nil if params[:remove_image]
if @project.save
   flash[:notice] = "Project #{@project} sucessfully updated"
   redirect_to projects_path
else
   render :action => 'edit
end

So basically we just have an extra param to flag the image for removal.

Eric