PostsController中的SyntaxError #new

时间:2016-07-24 09:38:46

标签: ruby-on-rails ruby

C:/Users/Sergey/forum/app/views/posts/_form.html.haml:2: syntax error, unexpected ')' ));}\n#{_hamlout.format_script... ^ 
C:/Users/Sergey/forum/app/views/posts/_form.html.haml:5: unterminated string meets end of file 
C:/Users/Sergey/forum/app/views/posts/_form.html.haml:5: syntax error, unexpected end-of-input, expecting keyword_end

_form.html.haml

= simple_form_for @post do |f|
=f.input :title
=f.input :content
=f.submit

1 个答案:

答案 0 :(得分:2)

Haml对缩进非常严格。空格很重要,不使用tab。下面缩进的代码应该有用。首先尝试erb(如果还没有),然后转移到haml。

= simple_form_for @post do |f|
  = f.input :title
  = f.input :content
  = f.submit