Rename service and use #call

This commit is contained in:
Matt-Yorkley
2020-06-18 17:14:50 +02:00
parent 5338e782f8
commit 130f639b61
2 changed files with 3 additions and 3 deletions

View File

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

View File

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