Ruby on rails HAML-“;“预期输入结束”;红宝石错误
有人知道为什么我的代码会出现这个错误吗 如果我删除错误捕获,它可以正常工作,但看不到错误捕获的问题是什么 谢谢Ruby on rails HAML-“;“预期输入结束”;红宝石错误,ruby-on-rails,haml,Ruby On Rails,Haml,有人知道为什么我的代码会出现这个错误吗 如果我删除错误捕获,它可以正常工作,但看不到错误捕获的问题是什么 谢谢 = simple_form_for @pic, html: { multipart: true } do |f| - if @pic.errors.any? #errors %h2 = pluralize(@pic.errors.count, "error") prevented this
= simple_form_for @pic, html: { multipart: true } do |f|
- if @pic.errors.any?
#errors
%h2
= pluralize(@pic.errors.count, "error")
prevented this Pic from saving
%ul
- @pic.errors.full_message.each do |msg|
%li= msg
.form-group
= f.input :title, input_html: { class: 'form-control' }
.form-group
= f.input :description, input_html: { class: 'form_control' }
= f.button :submit, class: "btn btn-info"
您的代码有缩进问题,请尝试以下操作
= simple_form_for @pic, html: { multipart: true } do |f|
- if @pic.errors.any?
#errors
%h2
= pluralize(@pic.errors.count, "error")
prevented this Pic from saving
%ul
- @pic.errors.full_message.each do |msg|
%li= msg
.form-group
= f.input :title, input_html: { class: 'form-control' }
.form-group
= f.input :description, input_html: { class: 'form_control' }
= f.button :submit, class: "btn btn-info"
希望有帮助 仔细检查缩进和间距。你能检查你的缩进并确保它是一致的吗?更多信息。另外,还要确保缩进与application.html.hamlcheers buddy:)一致,这是一种享受。我想我已经把缩进整理好了:)显然错过了1或2:D,非常感谢