我是haml的新手我试图将注册表单haml显示为erb,显示3个结束语句中的2个。我理解它在haml中存在的最终陈述,并且我不知道如何打算在这些位置使用end语句。
reg.html.haml:13: syntax error, unexpected end-of-input, expecting keyword_end
reg.html.haml:28: syntax error, unexpected end-of-input, expecting keyword_end
reg.html.haml:31: syntax error, unexpected end-of-input, expecting keyword_end
%h1 Registration
= form_for :article, url:articles_path do |f|
- if @article.errors.any?
#error_explanation
%h3
= pluralized(@articles.error.count, "Error")
prohibited this article from being saved:
%ul
%li= @article.errors.full_messages.each do |msg|
%li= msg
%p
= f.label :username
= f.text_field :username
%p
= f.label :password
= f.password_field :password
%p
= f.label :email
= f.text_field :email
%p
= f.label :address
= f.text_area :address
%p
= f.submit
%p
= link_to 'Back', articles_path
= link_to 'Home', controller: 'welcome'
答案 0 :(得分:1)
试试这个
%h1 Registration
= form_for :article, url:articles_path do |f|
- if @article.errors.any?
#error_explanation
%h3
= pluralized(@articles.error.count, "Error")
prohibited this article from being saved
%ul
- @article.errors.full_messages.each do |msg|
%li= msg
%p
= f.label :username
= f.text_field :username
%p
= f.label :password
= f.password_field :password
%p
= f.label :email
= f.text_field :email
%p
= f.label :address
= f.text_area :address
%p
= f.submit
%p
= link_to 'Back', articles_path
= link_to 'Home', controller: 'welcome'