开发者

In Rails 3 with haml-rails, why would =text_field :project... set params and not %input{:name => "project"...}?

开发者 https://www.devze.com 2023-03-25 01:10 出处:网络
If I do the following line in haml %input#project_images{:name => \"project[project_images]\", :type=>\'text\', :value => @project_images.join(\',\') }/

If I do the following line in haml

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

My projects_controller is returns params[:project][:project_images] as an empty string ""

On the other hand if I use the rails shortcut:

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

It works, and returns a string "1,2,3"

Here are the outputted html from the two different lines

<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

精彩评论

暂无评论...
验证码 换一张
取 消