Class: Saphira::FileItem

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/saphira/file_item.rb

Constant Summary collapse

TYPE_FILE =
'file'
TYPE_FOLDER =
'folder'

Instance Method Summary collapse

Instance Method Details

#attr_get(name) ⇒ Object



74
75
76
77
# File 'app/models/saphira/file_item.rb', line 74

def attr_get(name)
  self.dynamic_attributes ||= {}
  self.dynamic_attributes[name.to_sym]
end

#attr_set(name, value) ⇒ Object



68
69
70
71
72
# File 'app/models/saphira/file_item.rb', line 68

def attr_set(name, value)
  self.dynamic_attributes ||= {}
  self.dynamic_attributes[name.to_sym] = value
  self.dynamic_attributes = self.dynamic_attributes.delete_if { |k, v| v.blank? }
end

#to_paramObject



79
80
81
# File 'app/models/saphira/file_item.rb', line 79

def to_param
  self.path.empty? ? super : self.path
end