我正在关注本教程(http://ruby.railstutorial.org/chapters/sign-up#sec:signup_form)。然而,当清单 7.23中的代码(转换为 haml)
=if @user.errors.any?
%div{:id => "error_explanation"}
%div{:class=>"alert alert-error"}
il modulo contiene errori
%ul
= @user.errors.full_messages.each do |msg|
%li
= msg
我最终得到了双重打印输出:预期的打印输出,然后是变量的一种打印输出
Name can't be blank
Password is too long (maximum is 15 characters)
["Name can't be blank", "Password is too long (maximum is 15 characters)"]
<h1>Registrazione nuovo utente</h1> <div id='error_explanation'> <div class='alert alert-error'> il modulo contiene errori <ul> <li> Name can't be blank </li> <li> Password is too long (maximum is 15 characters) </li> ["Name can't be blank", "Password is too long (maximum is 15 characters)"]</ul> </div> </div>
我对 Rails 编程真的很陌生,但我真的不能。
谢谢, 马塞洛