Given the custom helper file in app/helpers/url_helper.rb
module UrlHelper
...
end
How do I make it accessible in all controllers and in all views?
You can put a method in a controller and then call helper_method in the controller to indicate that this method is available as if it were in a helper too. This method will then be available to all controllers and to all views.
Custom helpers for your application should be located in the app/helpers directory.
Or... include them into your controller
class ApplicationController < ActionController::Base
include UrlHelper
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With