noosfero | Deleting a Community keeps the UploadedFiles (#373)

Aaron gitlab at mg.gitlab.com
Mon Nov 5 03:04:30 BRST 2018


New Issue was created.

Issue 373: https://gitlab.com/noosfero/noosfero/issues/373
Author:    Aaron
Assignee:  

Deleting a `community` deletes all `articles` as it should, but `UploadedFiles` with a `profile_id` from an `Article` that is going to be deleted is kept and prevents the next start of noosfero with error:

```
rake aborted!
NoMethodError: undefined method `hostname' for nil:NilClass
/noosfero/app/models/article.rb:407:in `full_path'
/noosfero/lib/tasks/cache.rake:7:in `block (3 levels) in <top (required)>'
/noosfero/lib/tasks/cache.rake:6:in `block (2 levels) in <top (required)>'
Tasks: TOP => cache:private_files
(See full trace by running task with --trace)
```

Solution for me in rails console

```
UploadedFile.all.each do |a|
if !defined? Profile.find(a.profile_id).id
a.delete
end
end
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/issues/373
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20181105/3e699950/attachment.html>


More information about the Noosfero-dev mailing list