Module: AttachmerbFu::Backends::DbFileBackend
- Defined in:
- lib/attachmerb_fu/backends/db_file_backend.rb
Overview
Methods for DB backed attachments
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#create_temp_file ⇒ Object
Creates a temp file with the current db data.
-
#current_data ⇒ Object
Gets the current data from the database.
Class Method Details
.included(base) ⇒ Object
:nodoc:
5 6 7 8 |
# File 'lib/attachmerb_fu/backends/db_file_backend.rb', line 5 def self.included(base) #:nodoc: Object.const_set(:DbFile, Class.new(ActiveRecord::Base)) unless Object.const_defined?(:DbFile) base.belongs_to :db_file, :class_name => '::DbFile', :foreign_key => 'db_file_id' end |
Instance Method Details
#create_temp_file ⇒ Object
Creates a temp file with the current db data.
11 12 13 |
# File 'lib/attachmerb_fu/backends/db_file_backend.rb', line 11 def create_temp_file write_to_temp_file current_data end |
#current_data ⇒ Object
Gets the current data from the database
16 17 18 |
# File 'lib/attachmerb_fu/backends/db_file_backend.rb', line 16 def current_data db_file.data end |