8 methods module helper ruby-on-rails-4
我正在使用Rails 4.2.4.如何在模块中定义辅助(私有)方法?我有这个模块
module WebpageHelper
def get_url(url)
content = get_content(url)
..
end
def get_content(url)
…
end
module_function :get_url
end
Run Code Online (Sandbox Code Playgroud)
我不希望方法"get_content"可以公开访问,但是使用上面的代码我得到了错误
Error during processing: undefined method `get_content' for WebpageHelper:Module
Run Code Online (Sandbox Code Playgroud)
如何在我的模块中正确定义私有帮助器方法?