Class: ActiveFolder::Base

Inherits:
OpenStruct
  • Object
show all
Extended by:
Model::Traits::Collection, Model::Traits::Validation
Includes:
Model::Traits::Persistence, Model::Traits::Relation, Hooks
Defined in:
lib/activefolder/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model::Traits::Collection

build, create, create!, destroy_all, find_or_create, find_or_initialize

Methods included from Model::Traits::Enumeration

#all, #count, #find, #find!, #first, #last, #to_a, #where

Methods included from Model::Traits::Validation

validate

Class Method Details

.model_base_dirObject



44
# File 'lib/activefolder/base.rb', line 44

def model_base_dir; '/' end

.model_classObject



43
# File 'lib/activefolder/base.rb', line 43

def model_class; self; end

.model_nameObject



38
39
40
41
# File 'lib/activefolder/base.rb', line 38

def model_name
  model = name.to_s.demodulize
  model.underscore.pluralize
end

Instance Method Details

#attributesObject



33
34
35
# File 'lib/activefolder/base.rb', line 33

def attributes
  self.to_h.except(:name, :base_dir)
end

#pathObject



29
30
31
# File 'lib/activefolder/base.rb', line 29

def path
  File.join(base_dir, name)
end