form_for显示怎么出现两个啊??

new.haml:

[code="RUBY"]
= form_for :user, @user, :url => { :action => 'add' } do |f|
%p
%label 名字
= f.text_field :name, :size => 10
%p
%label 密码
= f.text_field :password, :size => 25

= f.submit "提交"
[/code]

我点了链接进来看到两个表单啊,两个提交按钮,怎么回事

请把第一个“=” 换成“-”

道理上讲,=用于ruby code的输出

  • 用于不输出的运算

参考:

The hyphen character makes the text following it into "silent script": Ruby script that is evaluated, but not output.

The equals character is followed by Ruby code, which is evaluated and the output inserted into the document as plain text.