我想做类似的事情:
project_paths = project_hash.keys
delegate :params, :h, :raw, :link_to, project_paths, to: :@view
但是project_paths
是一个数组,这在这里不起作用。
如何将符号数组转换为逗号分隔符号的“列表”,我可以将其输入delegate
?
答案 0 :(得分:4)
使用splat运算符:
delegate :params, :h, :raw, :link_to, *project_paths, to: :@view