你怎样才能避免在 .text.error 和 .text 后重复代码呢?
-if f.object.errors.any?
.text.error
= f.label :email
= f.text_field :email
%p#foo= "Escriba el e-mail"
= render 'shared/error_messages', :object => f.object, :param => :email
-else
.text
= f.label :email
= f.text_field :email
%p#foo= "Escriba el e-mail"
= render 'shared/error_messages', :object => f.object, :param => :email
-if f.object.errors.any?
.text.error
= f.label :password
= f.password_field :password
= render 'shared/error_messages', :object => f.object, :param => :password
-else
.text.error
= f.label :password
= f.password_field :password
= render 'shared/error_messages', :object => f.object, :param => :password