Class: Repository

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

Direct Known Subclasses

AppFile, Folder

Instance Method Summary collapse

Instance Method Details

#copy(target_folder) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/repository.rb', line 21

def copy(target_folder)
  #new_file = self.dup
  #new_file.folder = target_folder
  #new_file.save!
  #
  #path = "#{Rails.root}/uploads/#{Rails.env}/#{new_file.id}/original"
  #FileUtils.mkdir_p path
  #FileUtils.cp_r self.attachment.path, "#{path}/#{new_file.id}"
  #
  #new_file
end

#move(target_folder) ⇒ Object

Move the repository into the target_folder TODO à tester



35
36
37
38
39
# File 'app/models/repository.rb', line 35

def move(target_folder)
  if target_folder.type == 'Folder'
    self.update_attribute :parent, target_folder
  end
end