语法错误,意外的keyword_in,期待' |'

时间:2015-07-29 17:26:09

标签: ruby-on-rails syntax-error haml

该代码有什么问题?

%body
  - In.all.each do |in|
    = link_to in.name, categories_path(in: in.name)
  = yield

我的语法错误:

/home/ubuntu/workspace/app/views/layouts/application.html.haml:10: syntax error, unexpected keyword_in, expecting '|' In.all.each do |in| ^ 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:11: syntax error, unexpected keyword_in, expecting ')' ...e_false_true_false(( link_to in.name, categories_path (in: i... ... ^ 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:11: syntax error, unexpected ( arg, expecting keyword_do or '{' or '(' ...k_to in.name, categories_path (in: in.name) ... ^ 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:12: syntax error, unexpected ')', expecting tSTRING_DEND ));}\n", 0, false);end;_hamlout.push_text(" <end>\n #{ ^
/home/ubuntu/workspace/app/views/layouts/application.html.haml:12: syntax error, unexpected keyword_end ));}\n", 0, false);end;_hamlout.push_text(" <end>\n #{ ^ 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:14: syntax error, unexpected '}', expecting tSTRING_DEND ));}\n</body>\n", -1, false);::Ha... ^ 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:14: unterminated regexp meets end of file 
/home/ubuntu/workspace/app/views/layouts/application.html.haml:14: syntax error, unexpected end-of-input, expecting tSTRING_DEND

谢谢!

1 个答案:

答案 0 :(得分:0)

in是保留关键字。尝试使用其他东西作为块变量。