简体   繁体   English

RoR:语法错误,意外的tSTRING_BEG,期望')'

[英]RoR: syntax error, unexpected tSTRING_BEG, expecting ')'

I am getting the following error in my rails view: 我在rails视图中遇到以下错误:

app/views/welcome/index.html.haml:55: syntax error, unexpected tSTRING_BEG, expecting ')' ...ut.attributes({}, nil, :value="#{num}")}>#{_hamlout.adjust_t... ... ^ 

Here is the two lines that cause it (54 and 55 respectively) 这是导致它的两条线(分别为54和55)

=(1..52).each do |num|
      %option{:value="#{num}"} #{num.to_s} weeks

I am bassically just trying to connect "number " with "weeks" with the + string operator. 我只是大胆地尝试用+字符串运算符连接“数字”和“星期”。 But i am clearly in the wrong on my approach. 但是我的方法显然是错误的。

I think you are missing > on second line. 我认为您在第二行不见了。 Try this: 尝试这个:

=(1..52).each do |num|
     %option{:value => "#{num}"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM