mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-24 08:04:08 +01:00
add attachment model and add paperclip
This commit is contained in:
parent
47c686ce8e
commit
8c17578f38
2 changed files with 2 additions and 6 deletions
|
|
@ -1,13 +1,9 @@
|
|||
class Attachment < ActiveRecord::Base
|
||||
belongs_to :todo, touch: true
|
||||
|
||||
# enable write permissions on group, since MessageGateway could be run under different
|
||||
# user than Tracks (i.e. apache versus mail)
|
||||
|
||||
has_attached_file :file,
|
||||
url: '/:class/:id/:basename.:extension',
|
||||
path: ":rails_root/db/assets/#{Rails.env}/:class/:id/:basename.:extension",
|
||||
override_file_permissions: 0660
|
||||
path: ":rails_root/db/assets/#{Rails.env}/:class/:id/:basename.:extension"
|
||||
|
||||
do_not_validate_attachment_file_type :file
|
||||
# validates_attachment_content_type :file, :content_type => ["text/plain"]
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Todo < ActiveRecord::Base
|
|||
has_many :pending_successors, -> {where('todos.state = ?', 'pending')}, :through => :predecessor_dependencies,
|
||||
:source => :successor
|
||||
|
||||
has_many :attachments, dependent: :destroy
|
||||
has_many :attachments, dependent: :delete_all
|
||||
|
||||
# scopes for states of this todo
|
||||
scope :active, -> { where state: 'active' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue