Sha256: ed3723d8c4f870f63f38e17e06156b82fbbba37ce456c75ad749f5a6c3e401e6

Contents?: true

Size: 1.17 KB

Versions: 54

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

module CarrierWave
  module Uploader
    module Mountable

      attr_reader :model, :mounted_as

      ##
      # If a model is given as the first parameter, it will stored in the uploader, and
      # available throught +#model+. Likewise, mounted_as stores the name of the column
      # where this instance of the uploader is mounted. These values can then be used inside
      # your uploader.
      #
      # If you do not wish to mount your uploaders with the ORM extensions in -more then you
      # can override this method inside your uploader. Just be sure to call +super+
      #
      # === Parameters
      #
      # [model (Object)] Any kind of model object
      # [mounted_as (Symbol)] The name of the column where this uploader is mounted
      #
      # === Examples
      #
      #     class MyUploader < CarrierWave::Uploader::Base
      #
      #       def store_dir
      #         File.join('public', 'files', mounted_as, model.permalink)
      #       end
      #     end
      #
      def initialize(model=nil, mounted_as=nil)
        @model = model
        @mounted_as = mounted_as
      end

    end # Mountable
  end # Uploader
end # CarrierWave

Version data entries

54 entries across 54 versions & 12 rubygems

Version Path
andrewtimberlake-carrierwave-0.3.2.1 lib/carrierwave/uploader/mountable.rb
durran-carrierwave-0.3.2.3 lib/carrierwave/uploader/mountable.rb
jnicklas-carrierwave-0.3.2.1 lib/carrierwave/uploader/mountable.rb
jnicklas-carrierwave-0.3.2 lib/carrierwave/uploader/mountable.rb
jnicklas-carrierwave-0.3.3 lib/carrierwave/uploader/mountable.rb
carrierwave-pressplane-0.5.8.3 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.8 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.7 lib/carrierwave/uploader/mountable.rb
potatosalad-carrierwave-0.5.7.1 lib/carrierwave/uploader/mountable.rb
potatosalad-carrierwave-0.5.7 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.6 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.5 lib/carrierwave/uploader/mountable.rb
locomotive_carrierwave-0.5.4.beta3 lib/carrierwave/uploader/mountable.rb
locomotive_carrierwave-0.5.4.beta2 lib/carrierwave/uploader/mountable.rb
locomotive_carrierwave-0.5.4.beta1 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.4 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.3 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.2 lib/carrierwave/uploader/mountable.rb
carrierwave-0.5.1 lib/carrierwave/uploader/mountable.rb
thorsson_carrierwave-0.4.12 lib/carrierwave/uploader/mountable.rb