class Service
Ruby on Rails 7.0.10
Since v5.2.8.1Abstract class serving as an interface for concrete services.
The available services are:
-
Disk, to manage attachments saved directly on the hard drive. -
GCS, to manage attachments through Google Cloud Storage. -
S3, to manage attachments through Amazon S3. -
AzureStorage, to manage attachments through Microsoft Azure Storage. -
Mirror, to be able to use several services to manage attachments.
Inside a Rails application, you can set-up your services through the generated config/storage.yml file and reference one of the aforementioned constant under the service key. For example:
local:
service: Disk
root: <%= Rails.root.join("storage") %>
You can checkout the service’s constructor to know which keys are required.
Then, in your application’s configuration, you can specify the service to use like this:
config.active_storage.service = :local
If you are using Active Storage outside of a Ruby on Rails application, you can configure the service to use like this:
ActiveStorage::Blob.service = ActiveStorage::Service.configure( :local, { local: {service: "Disk", root: Pathname("/tmp/foo/storage") } } )
Inherits from
Namespace
Classes
Extends
Attributes
Methods (defined here)
- # compose
- # delete
- # delete_prefixed
- # download
- # download_chunk
- # exist?
- # headers_for_direct_upload
- # open
- # public?
- # update_metadata
- # upload
- # url
- # url_for_direct_upload
- self. configure
Private methods
(6)
Implementation detail — not part of the public API.
Used by
Subclasses (5)
Methods (inherited)
From ActiveSupport::Autoload (6)
- # autoload
- # autoload_at
- # autoload_under
- # autoloads
- # eager_autoload
- # eager_load!
From Object (16)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with_options
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended