[英]Ruby: How do you pass in multiple :locals into index.erb?
somevariable = "hello"
answer = {yesorno: "yes"}
anotheranswer = {whatisit: somevariable}
erb :index, :locals => answer, anotheranswer
When I try to run the server it says : 当我尝试运行服务器时,它说:
syntax error, unexpected '\\n', expecting =>. 语法错误,意外的'\\ n',期望=>。
If I remove the anotheranswer
from the locals, then it just passes in that one answer, and it works fine. 如果我删除anotheranswer
从当地人,那么它只是在传递一个答案,并能正常工作。
How do I pass in multiple :locals
? 如何传递多个:locals
?
它们都必须在同一哈希中。
erb :index, :locals => { whatisit: somevariable, yesorno: "yes" }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.