mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-13 02:44:22 +01:00
make attachments accesible from user model and fix cleaning up attachment on destroy
This commit is contained in:
parent
8d9f07f57b
commit
a28edbd5d6
5 changed files with 40 additions and 7 deletions
|
|
@ -7,4 +7,14 @@ class Attachment < ActiveRecord::Base
|
|||
|
||||
do_not_validate_attachment_file_type :file
|
||||
# validates_attachment_content_type :file, :content_type => ["text/plain"]
|
||||
|
||||
before_destroy :delete_attached_file
|
||||
|
||||
private
|
||||
|
||||
def delete_attached_file
|
||||
file = nil
|
||||
save!
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue