diff --git a/app/serializers/api/enterprise_shopfront_list_serializer.rb b/app/serializers/api/enterprise_shopfront_list_serializer.rb index 874e3516d5..0dccfaa1c2 100644 --- a/app/serializers/api/enterprise_shopfront_list_serializer.rb +++ b/app/serializers/api/enterprise_shopfront_list_serializer.rb @@ -19,7 +19,7 @@ module Api producer_shop: "map_003-producer-shop.svg", producer: "map_001-producer-only.svg", } - ImagePathService.image_path(icons[enterprise.category]) + ImagePathGenerator.call(icons[enterprise.category]) end def icon_font diff --git a/app/services/image_path_service.rb b/app/services/image_path_generator.rb similarity index 85% rename from app/services/image_path_service.rb rename to app/services/image_path_generator.rb index b7cf5815db..48c9ee93d1 100644 --- a/app/services/image_path_service.rb +++ b/app/services/image_path_generator.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -class ImagePathService +class ImagePathGenerator # Since Rails 4 has adjusted the way assets paths are handled, we have to access certain # asset-based helpers like this when outside of a view or controller context. # See: https://stackoverflow.com/a/16609815 - def self.image_path(path) + def self.call(path) ActionController::Base.helpers.image_path(path) end end