1
0

routing_helper.rb 566 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. module RoutingHelper
  3. extend ActiveSupport::Concern
  4. include Rails.application.routes.url_helpers
  5. include ActionView::Helpers::AssetTagHelper
  6. included do
  7. def default_url_options
  8. ActionMailer::Base.default_url_options
  9. end
  10. end
  11. def full_asset_url(source, options = {})
  12. source = ActionController::Base.helpers.asset_url(source, options) unless use_storage?
  13. URI.join(root_url, source).to_s
  14. end
  15. private
  16. def use_storage?
  17. Rails.configuration.x.use_s3 || Rails.configuration.x.use_swift
  18. end
  19. end