Sha256: 80cc5cacf26d8aa39ab3a5e324a3556e2d88be174aff94db1fb16f1fa5197592

Contents?: true

Size: 590 Bytes

Versions: 7

Compression:

Stored size: 590 Bytes

Contents

class Lalala::Uploaders::Image < CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick
  include Sprockets::Helpers::RailsHelper
  include Sprockets::Helpers::IsolatedHelper

  def store_dir
    if Rails.env.production? or Rails.env.staging?
      "#{model.class.to_s.underscore}/#{model.id}"
    else
      "uploads/#{model.class.to_s.underscore}/#{model.id}"
    end
  end

  def url(*)
    if Rails.env.production? or Rails.env.staging?
      File.join("/storage/assets", super)
    else
      super
    end
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lalala-4.0.0.dev.94 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.92 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.90 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.84 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.80 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.79 lib/lalala/uploaders/image.rb
lalala-4.0.0.dev.78 lib/lalala/uploaders/image.rb