This works for me:
ModelName.find(your_parameters_here).update_attribute
:your_image_column_name, nil
doppler
On 1/22/06, John Tsombakos <johnts@charter.net>
wrote:>
> So I am now able to set/upload an image to my app using file_column,
> with a little bit of a change to the code.
>
> I can change the image using an Edit page, but I''m trying to
figure out
> what to do if the user wants to remove the image. I tried adding a
> Remove Image link in my list, but I''m not sure what to do in the
> remove_image method in my controller. I tried setting the
''image'' value
> to ''''; I tried using update_attribute to set to
'''' and neither did
> anything. The SQL update command that was logged just showed it
> replacing the records values with the same data - ie. not changing
> anything.
>
> I tried doing an update_attribute to "", but I got an error from
> file_column:
>
> (Do not know how to handle a string with value ''nothing''
that was passed
> to a file_column. Check if the form''s encoding has been set to
> ''multipart/form-data''.)
>
> Yeah, newbie... ;)
>
> (And I haven''t even added a second relationship table to my app
> yet..figured this would be the easy part.)
>
> Thanks.
>
> jt
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060123/bd4eb51c/attachment.html