0

我在尝试索引数据时写了这个

= form_tag blog_posts_path, method: :get do
%p
= text_field_tag :query, params[:query]
= submit_tag "Search", name: nil

我得到了这个错误,我真的不知道如何解决它:

/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected ')'
));}\n<p></p>\n#{
 ^
/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected '<'
));}\n<p></p>\n#{
      ^
/home/marina/project/app/views/blog_posts/index.haml:15: unterminated regexp meets end of fail
/home/marina/project/app/views/blog_posts/index.haml:15: syntax error, unexpected $end, expecting keyword_end

提取的源代码(大约第 15 行):

12: %br
13: 
14: = form_tag blog_posts_path, method: :get do
15: %p
16: = text_field_tag :query, params[:query]
17: = submit_tag "Search", name: nil
18: 
4

1 回答 1

0

是的,这似乎是一个缩进问题。您应该将 %p 缩进一次,最后两行缩进两次。

于 2012-04-07T22:19:19.760 回答