Module: SimpleActiveStorage

Includes:
ActiveSupport::Configurable
Defined in:
lib/simple_active_storage/attached.rb,
lib/simple_active_storage.rb,
lib/simple_active_storage/url.rb,
lib/simple_active_storage/railtie.rb,
lib/simple_active_storage/version.rb,
lib/simple_active_storage/variation.rb,
lib/simple_active_storage/direct_uploads_controller.rb

Overview

假设单个图片为picture 多个图片为pictures

Defined Under Namespace

Modules: Attached, DirectUploadsController, Url, Variation Classes: Railtie, TransformationNotFound

Constant Summary collapse

VERSION =
'0.1.5'

Class Method Summary collapse

Class Method Details

.transformation(name, transformation = nil, &block) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/simple_active_storage/variation.rb', line 5

def self.transformation(name,transformation = nil,&block)
  self.transformations ||= {}
  if block_given?
    transformation = yield
  end
  transformations[name] = transformation
end

.transformation_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/simple_active_storage/variation.rb', line 13

def self.transformation_exists?(name)
  self.transformations.keys.include? name
end

.url_helpersObject



3
4
5
# File 'lib/simple_active_storage/url.rb', line 3

def self.url_helpers
  Rails.application.routes.url_helpers
end