Class: ElVfs::Entry

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

Direct Known Subclasses

Directory, File, Root

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rootObject



21
22
23
# File 'app/models/el_vfs/entry.rb', line 21

def self.root
  Root.find_or_create_by_entry_name('root')
end

Instance Method Details

#directoriesObject



13
14
15
# File 'app/models/el_vfs/entry.rb', line 13

def directories
  children.only_directories
end

#duplicateObject



33
34
35
36
37
38
39
40
# File 'app/models/el_vfs/entry.rb', line 33

def duplicate
  Entry.transaction do
    dup.tap do | entry |
      entry.update_attributes! :entry_name => entry.duplicate_name
      self.copy_descendants_to(entry)
    end
  end
end

#el_hashObject



25
26
27
# File 'app/models/el_vfs/entry.rb', line 25

def el_hash
  el_entry.merge(el_permissions)
end

#filesObject



17
18
19
# File 'app/models/el_vfs/entry.rb', line 17

def files
  children.only_files
end

#targetObject



29
30
31
# File 'app/models/el_vfs/entry.rb', line 29

def target
  entry_path_hash
end

#to_sObject Also known as: inspect



46
47
48
# File 'app/models/el_vfs/entry.rb', line 46

def to_s
  entry_path
end

#urlObject



42
43
44
# File 'app/models/el_vfs/entry.rb', line 42

def url
  ::Rails.application.routes.url_helpers.entry_url(self, ::Rails.application.config.action_mailer[:default_url_options])
end