Files
openfoodnetwork/app/services/image_path_generator.rb
2020-06-18 17:14:50 +02:00

11 lines
357 B
Ruby

# frozen_string_literal: true
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.call(path)
ActionController::Base.helpers.image_path(path)
end
end