Class: Droom::DocumentAttachment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/droom/document_attachment.rb

Instance Method Summary collapse

Instance Method Details

#category_nameObject



18
19
20
# File 'app/models/droom/document_attachment.rb', line 18

def category_name
  category ? category.name : "uncategorised"
end

#move_document_to_folderObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/droom/document_attachment.rb', line 22

def move_document_to_folder
  recipient = if category
    # attachee will be an event
    attachee.find_or_create_agenda_category(category)
  else
    attachee
  end
  if document
    document.folder = nil
    recipient.receive_document(document)
    document.save
  end
end

#slugObject



10
11
12
13
14
15
16
# File 'app/models/droom/document_attachment.rb', line 10

def slug
  if attachee 
    attachee.slug
  else
    'Unattached'
  end
end