Class: DSMediaLibrary::Folder

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rootObject



8
9
10
11
12
13
# File 'app/models/ds_media_library/folder.rb', line 8

def self.root
  klass = Struct.new(:children, :resources)
  children = Folder.roots.to_a.sort_by(&:name)
  resources = DSNode::Resource.where(folder_id: nil).order(:original_file_name)
  klass.new(children, resources)
end

Instance Method Details

#all_foldersObject



23
24
25
# File 'app/models/ds_media_library/folder.rb', line 23

def all_folders
  self.class.all
end

#childrenObject



19
20
21
# File 'app/models/ds_media_library/folder.rb', line 19

def children
  super.order(:name)
end