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?