![](/img/trans.png)
[英]How would I bring in Jquery items to update an index.erb in Sinatra?
[英]Ruby: How do you pass in multiple :locals into index.erb?
somevariable = "hello"
answer = {yesorno: "yes"}
anotheranswer = {whatisit: somevariable}
erb :index, :locals => answer, anotheranswer
當我嘗試運行服務器時,它說:
語法錯誤,意外的'\\ n',期望=>。
如果我刪除anotheranswer
從當地人,那么它只是在傳遞一個答案,並能正常工作。
如何傳遞多個:locals
?
它們都必須在同一哈希中。
erb :index, :locals => { whatisit: somevariable, yesorno: "yes" }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.