# Problems delete record using attachment\_fu

**URL:** <https://www.ruby-forum.com/t/problems-delete-record-using-attachment-fu/171858>\
**Category:** Rails\
**Created:** [July 10, 2009, 9:02am UTC](https://www.ruby-forum.com/t/problems-delete-record-using-attachment-fu/171858 "2009-07-10T09:02:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [July 10, 2009, 9:02am UTC](https://www.ruby-forum.com/t/problems-delete-record-using-attachment-fu/171858/1 "2009-07-10T09:02:21Z")

</div>

Hello,

I’m having problems deleteing records that doesn’t have attachments even  
though the model supports them. When I create a record with a attachment  
I can delete it without problems but when it comes to deleting a record  
that doesn’t have a attachment I get following error:  
TypeError in NewsController#destroy

can’t convert nil into String

RAILS\_ROOT: F:/NetBeansProjects/sportfreundewitold.de  
Application Trace | Framework Trace | Full Trace

vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu/backends/file\_system\_backend.rb:21:in  
`join' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:21:in`full\_filename’  
vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu/backends/file\_system\_backend.rb:63:in  
`destroy_file' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:178:in`send’  
D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/callbacks.rb:178:in  
`evaluate_method' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:166:in`call’  
D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/callbacks.rb:93:in  
`run' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:92:in`each’  
D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/callbacks.rb:92:in  
`send' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:92:in`run’  
vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu.rb:443:in  
`run_callbacks' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:315:in`callback’  
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/callbacks.rb:309:in  
`destroy_without_transactions' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:179:in`send’  
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/transactions.rb:179:in  
`with_transaction_returning_status' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in`transaction’  
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/transactions.rb:129:in  
`transaction' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in`transaction’  
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/transactions.rb:178:in  
`with_transaction_returning_status' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:142:in`destroy’  
app/controllers/news\_controller.rb:94:in `destroy’

That’s probably because it tries to delete a attachment that isn’t  
there. Is there any solution to this?  
Is it possible to load a local (on a server) image as a attachment and  
attach it to the record if the user didn’t upload anything creating the  
record?
