Created
January 4, 2021 18:10
-
-
Save mcls/530e8cd23fad2c1ed55784fdae596a8c to your computer and use it in GitHub Desktop.
Revisions
-
mcls created this gist
Jan 4, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # Make it easier to call rails routes from anywhere class Routes include Rails.application.routes.url_helpers delegate :asset_path, :image_path, to: :controller_helpers protected def controller_helpers ActionController::Base.helpers end class << self def default_url_options ActionMailer::Base.default_url_options end end end # Examples ROUTER = Routes.new ROUTER.root_path # => "/" ROUTER.asset_path("logo.png") # => "/assets/logo-4877cac84535062a0d0a24c77c7a09bcb3290a4ec0beda3a401f6f60713bce5f.png"