aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorAbhay Nikam <nikam.abhay1@gmail.com>2019-02-13 23:29:48 +0530
committerAbhay Nikam <nikam.abhay1@gmail.com>2019-02-14 23:06:42 +0530
commitd3f92261902d09adf54dbc211e3a1080d943440b (patch)
tree4a96d5e7b8045f9aa1dfcef0a1c7e2ab2600131b /activestorage
parente53430fa9af239e21e11548499d814f540d421e5 (diff)
downloadrails-d3f92261902d09adf54dbc211e3a1080d943440b.tar.gz
rails-d3f92261902d09adf54dbc211e3a1080d943440b.tar.bz2
rails-d3f92261902d09adf54dbc211e3a1080d943440b.zip
Delegated path_for to primary in the MirrorService
Diffstat (limited to 'activestorage')
-rw-r--r--activestorage/lib/active_storage/service/mirror_service.rb2
-rw-r--r--activestorage/test/service/mirror_service_test.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/activestorage/lib/active_storage/service/mirror_service.rb b/activestorage/lib/active_storage/service/mirror_service.rb
index 75274f81b3..aa41df304e 100644
--- a/activestorage/lib/active_storage/service/mirror_service.rb
+++ b/activestorage/lib/active_storage/service/mirror_service.rb
@@ -9,7 +9,7 @@ module ActiveStorage
class Service::MirrorService < Service
attr_reader :primary, :mirrors
- delegate :download, :download_chunk, :exist?, :url, to: :primary
+ delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
# Stitch together from named services.
def self.build(primary:, mirrors:, configurator:, **options) #:nodoc:
diff --git a/activestorage/test/service/mirror_service_test.rb b/activestorage/test/service/mirror_service_test.rb
index 94c751a4ff..249a5652fb 100644
--- a/activestorage/test/service/mirror_service_test.rb
+++ b/activestorage/test/service/mirror_service_test.rb
@@ -61,4 +61,8 @@ class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
@service.url(@key, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain")
end
end
+
+ test "path for file in primary service" do
+ assert_equal @service.primary.path_for(@key), @service.path_for(@key)
+ end
end