Sha256: 05bef3c4908f1d851cbef5d42c930f98e4b52f9f6753cbf6db51ff62074c5f69

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

module ScribdFu
  module AttachmentFu

    module ClassMethods
    end

    module InstanceMethods

      def self.included(base)
        base.extend ClassMethods
      end

      # Returns a URL for a thumbnail for this model's attachment.
      def thumbnail_url
        (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)
      end

      # Returns the content type for this model's attachment.
      def get_content_type
        self.content_type
      end

      # Yields the correct path to the file, either the local filename or the S3 URL.
      def file_path
        if public_filename =~ ScribdFu::S3 || public_filename =~ ScribdFu::CLOUD_FRONT
          public_filename
        else
          "#{RAILS_ROOT}/public#{public_filename}"
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scribd_fu-2.0.7 lib/scribd_fu/attachment_fu.rb
scribd_fu-2.0.6 lib/scribd_fu/attachment_fu.rb
scribd_fu-2.0.5 lib/scribd_fu/attachment_fu.rb