我有一个带函数的模块.它位于/lib/contact中.rb:
module Contact
class << self
def run(current_user)
...
end
end
end
我想访问模块内的URL帮助程序,如"用户路径".我该怎么做?
我有一个带函数的模块.它位于/lib/contact中.rb:
module Contact
class << self
def run(current_user)
...
end
end
end
我想访问模块内的URL帮助程序,如"用户路径".我该怎么做?
在您的模块中,只需执行以下操作:
include Rails.application.routes.url_helpers