当我运行show#error space error如果我删除#errors行显示#p错误更深的错误

问题描述 投票:0回答:1
Haml::SyntaxError in Recipes#new
Showing /home/shoaib/Documents/Projects/recipe_box/app/views/recipes/_form.html.haml where line #4 raised:

The line was indented 4 levels deeper than the previous line.
Extracted source (around line #4):
2
3
4
5
6
7

 - if @recipe.errors.any?
 #errors
     %p
       = @recipe.errors.count
       Prevented this recipe froms saving
     %ul
ruby-on-rails haml
1个回答
0
投票

#errors之前添加两个空格。 Haml缩进是它的基础,它定义了它的代码块而不是使用结束行,所以你必须尊重它,你应该只有空格(而不是制表符)并且总是相同的数量(约定是2个空格)。

© www.soinside.com 2019 - 2024. All rights reserved.