我有一个带有文本输入和文本区域的简单表单,但是当我提交它时,变量似乎是数组项,而不仅仅是字符串值?
表格
<%= form_tag(home_kontak_path, :remote => true) do %>
<label>Jou epos adres</label>
<%= text_field(:epos, "", :placeholder => "Jou epos adres", :id => "epos", :class => "input-block-level") %>
<label>Boodskap hier</label>
<%= text_area(:boodskap, "", :rows => "5", :placeholder => "Boodskap hier...", :id => "boodskap", :class => "input-block-level") %>
<%= submit_tag "submit" %>
<% end %>
控制台输出
Started POST "/home/kontak" for 127.0.0.1 at 2012-11-23 11:53:03 +0200
Processing by HomeController#kontak as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"i+5UWaQeBu7LYGPFBNAbum+67VzyyC82JN2wMlLc/UU=", "epos"=>["text box value"], "boodskap"=>["text area value"], "commit"=>""}
我希望它是什么
而不是
"epos"=>["文本框值"]
我想让它回来
"epos"=>"文本框值"
更新
我尝试了以下语法无济于事
<%= text_field "epos", "", :placeholder => "Jou epos adres", :id => "epos", :class => "input-block-level" %>
和
<%= text_field :epos, "", :placeholder => "Jou epos adres", :id => "epos", :class => "input-block-level" %>
我仍然得到
Started POST "/home/kontak" for 127.0.0.1 at 2012-11-23 13:34:57 +0200
Processing by HomeController#kontak as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"i+5UWaQeBu7LYGPFBNAbum+67VzyyC82JN2wMlLc/UU=", "epos"=>["asd"], "boodskap"=>["asd"], "commit"=>""}