更新时间:2023-09-28 14:45:46
要创建一个新的助手:
根据文件名创建模块.在这种情况下
create a module according to the file name. In this case
module TagsHelper
end
将您的助手定义为方法
define your helper as method
module TagsHelper
def hello_world(name)
"hello #{name}"
end
end
现在您可以在视图中使用 hello_world
辅助方法.
Now you can use the hello_world
helper method in your view.