Ruby on rails 如何在Ruby中的自定义方法中添加url_

Ruby on rails 如何在Ruby中的自定义方法中添加url_,ruby-on-rails,forms,module,helper,Ruby On Rails,Forms,Module,Helper,我正在编写自定义表单帮助程序,需要在routes中声明URL路径,但出现以下错误: module CustomFormHelpers include ActionView::Helpers::TagHelper include ActionView::Helpers::FormTagHelper include ActionView::Helpers::FormOptionsHelper include ActionView::Helpe

我正在编写自定义表单帮助程序,需要在routes中声明URL路径,但出现以下错误:


    module CustomFormHelpers
      include ActionView::Helpers::TagHelper
      include ActionView::Helpers::FormTagHelper
      include ActionView::Helpers::FormOptionsHelper
      include ActionView::Helpers::CaptureHelper
      include ActionView::Helpers::AssetTagHelper
      include ActionView::Helpers::RawOutputHelper
      include ActionView::Helpers::JavaScriptHelper
      include ActionView::Helpers::UrlHelper

      def tags
        tags_path
      end

    end
我需要在模块中包含哪些内容才能重复使用

简短答复:

include Rails.application.routes.url_helpers

请在
或``块内重新格式化代码。此外,错误没有显示。什么错误?我没有看到一个,尽管我确实看到一个奇怪的单词,看起来像是打字错误:“rosources”。错误:未定义的局部变量或方法“\u routes”#
include Rails.application.routes.url_helpers