Class: ActiveFile::Base
Class Method Summary
collapse
full_paths, multiple_files?, multiple_files?, set_filenames, use_multiple_files
#[], #[]=, #_read_attribute, add_default_value, add_to_record_index, all, #attributes, auto_assign_fields, base_class, cache_key, #cache_key, compute_type, configuration_for_custom_finder, create, create!, data, data=, define_custom_find_all_method, define_custom_find_method, define_getter_method, define_interrogator_method, define_setter_method, #destroyed?, empty?, #eql?, #errors, exists?, field, field_names, fields, #hash, #id, #id=, #initialize, insert, mark_clean, mark_dirty, #marked_for_destruction?, method_missing, #new_record?, next_id, #persisted?, pluralize_table_names, polymorphic_name, primary_key, #readonly?, record_index, reset_record_index, respond_to?, #save, scope, the_meta_class, #to_param, transaction, #valid?, validate_field, validate_unique_id
Class Method Details
.actual_root_path ⇒ Object
44
45
46
|
# File 'lib/active_file/base.rb', line 44
def actual_root_path
root_path || Dir.pwd
end
|
.delete_all ⇒ Object
10
11
12
13
|
# File 'lib/active_file/base.rb', line 10
def delete_all
self.data_loaded = true
super
end
|
.extension ⇒ Object
39
40
41
|
# File 'lib/active_file/base.rb', line 39
def extension
raise "Override Me"
end
|
.full_path ⇒ Object
34
35
36
37
|
# File 'lib/active_file/base.rb', line 34
def full_path
actual_filename = filename || name.tableize
File.join(actual_root_path, "#{actual_filename}.#{extension}")
end
|
.load_file ⇒ Object
30
31
32
|
# File 'lib/active_file/base.rb', line 30
def load_file
raise "Override Me"
end
|
.reload(force = false) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/active_file/base.rb', line 15
def reload(force = false)
return if !self.dirty && !force && self.data_loaded
self.data_loaded = true
self.data = load_file
mark_clean
end
|
.set_filename(name) ⇒ Object
22
23
24
|
# File 'lib/active_file/base.rb', line 22
def set_filename(name)
self.filename = name
end
|
.set_root_path(path) ⇒ Object
26
27
28
|
# File 'lib/active_file/base.rb', line 26
def set_root_path(path)
self.root_path = path
end
|