在带有haml-rails的Rails 3中,为什么= text_field:project ... set params而不是%input {:name => “项目”...}?

时间:2011-08-03 02:07:33

标签: ruby-on-rails-3 forms haml

如果我在haml中执行以下行

%input#project_images{:name => "project[project_images]", :type=>'text', :value => @project_images.join(',') }/

我的projects_controller返回params[:project][:project_images]为空字符串""

另一方面,如果我使用rails快捷键:

= text_field( :project, :project_images, :value => @project_images.join(','))

它可以工作,并返回一个字符串"1,2,3"

以下是来自两个不同行的输出html

<input id="project_images" name="project[project_images]" type="text" value="1,2,3">
<input id="project_project_images" name="project[project_images]" size="30" type="text" value="1,2,3">

0 个答案:

没有答案