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?
Or... include them into your controller
class ApplicationController < ActionController::Base
include UrlHelper
end
将它放在ApplicationController(不是帮助器)中并声明helper_method :method_name
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.