1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Delegated path_for to primary in the MirrorService

This commit is contained in:
Abhay Nikam 2019-02-13 23:29:48 +05:30
parent e53430fa9a
commit d3f9226190
2 changed files with 5 additions and 1 deletions

View file

@ -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:

View file

@ -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