Sha256: b6e1056147a369928339eae5fe092834133f41b1db076a351ef459465e6a8739

Contents?: true

Size: 584 Bytes

Versions: 17

Compression:

Stored size: 584 Bytes

Contents

module Lolita
  module Configuration
    module Field

      class File< Lolita::Configuration::Field::Base
        lolita_accessor :version

        def initialize dbi,name,*args, &block
          super
        end

        def cache_name
          :"#{name}_cache"
        end

        def has_image?(record)
          record.send(:"#{name}?")
        end

        def preview_image(record)
          record.send(name).send(accessible_version).url
        end

        private

        def accessible_version
          @version || :preview
        end

      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lolita-file-upload-1.0.5 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-1.0.4 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-1.0.3 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-1.0.2 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-1.0.1 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-1.0.0 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.8.3 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.8.2 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.8.1 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.8.0 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.7.3 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.7.2 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.7.1 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.6.2 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.6.1 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.6.0 lib/lolita-file-upload/configuration/field/file.rb
lolita-file-upload-0.5.0 lib/lolita-file-upload/configuration/field/file.rb