Module: Technoweenie::AttachmentFu::Backends::DbFileBackend
- Defined in:
- lib/technoweenie/attachment_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:
6 7 8 9 |
# File 'lib/technoweenie/attachment_fu/backends/db_file_backend.rb', line 6 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.
12 13 14 |
# File 'lib/technoweenie/attachment_fu/backends/db_file_backend.rb', line 12 def create_temp_file write_to_temp_file current_data end |
#current_data ⇒ Object
Gets the current data from the database
17 18 19 |
# File 'lib/technoweenie/attachment_fu/backends/db_file_backend.rb', line 17 def current_data db_file.data end |