Sha256: 04f3bff2b367e3564cd201c95e4dccfdcdc08870b34cf47db2ec2043ca4c7e55
Contents?: true
Size: 880 Bytes
Versions: 8
Compression:
Stored size: 880 Bytes
Contents
module RailsConnector class CouchBlob def self.find(id, options) cache_key = [:blob, id] attachment = Cache.load(cache_key) unless attachment ActiveSupport::Notifications.instrumenter.instrument("cms_load.rails_connector", :name => "Blob Load", :index => "blobs", :keys => [options[:context]] ) do attachment = CmsBaseModel.adapter.blob_attachment(id) Cache.store(cache_key, attachment) end end new(id, attachment) end def self.configure(spec) # connection is taken from CmsBaseModel on demand end attr_reader :id, :attachment def initialize(id, attachment) @id = id @attachment = attachment end def url CmsBaseModel.adapter.blob_url(id) end def content_type attachment["content_type"] end def length attachment['length'] end end end # module RailsConnector
Version data entries
8 entries across 8 versions & 1 rubygems