简体   繁体   中英

RoR: syntax error, unexpected tSTRING_BEG, expecting ')'

I am getting the following error in my rails view:

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)

=(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}"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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