所以我试图在辅助模块中调用link_to
这是代码
module GroupsHelper
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
def self.link_to_publish
link_to "test"
end
end
返回
undefined local variable or method `link_to' for GroupsHelper:Module
有谁知道为什么? THX
答案 0 :(得分:2)
放弃“自我”。这不是一种阶级方法。
假设:GroupsHelper位于rails app的app / helpers / groups_helper.rb