Module: FileManagerEngine
- Defined in:
- lib/file_manager_engine.rb,
lib/file_manager_engine/engine.rb,
lib/file_manager_engine/version.rb
Overview
File Manager Engine module
Defined Under Namespace
Modules: ClassMethods Classes: Engine
Constant Summary collapse
- VERSION =
"0.0.4"
Class Method Summary collapse
-
.included(base) ⇒ Object
This static method is used to extend methods in other
base
class in which this class is included.
Instance Method Summary collapse
-
#make_relation_file ⇒ Object
This method creates an instance in database for each file relationated with the new document generated if the content is modifcated, this method remake all relations between file/s and this content.
Class Method Details
.included(base) ⇒ Object
This static method is used to extend methods in other base
class in which this class is included
17 18 19 20 |
# File 'lib/file_manager_engine.rb', line 17 def self.included(base) base.extend(ClassMethods) base.after_save :make_relation_file end |
Instance Method Details
#make_relation_file ⇒ Object
This method creates an instance in database for each file relationated with the new document generated if the content is modifcated, this method remake all relations between file/s and this content.
24 25 26 27 28 29 |
# File 'lib/file_manager_engine.rb', line 24 def make_relation_file ary = self.send(self.class.file_field_name.to_sym) to_array(ary).each do |file| FileManager.new({ :entity_type => self.class.name, :entity_id => self.id, :file => file }).save end end |