Ruby on rails form variables as array items

Posted by Francois on Stack Overflow See other posts from Stack Overflow or by Francois
Published on 2012-11-23T09:56:36Z Indexed on 2012/11/23 10:59 UTC
Read the original article Hit count: 296

Filed under:
|
|

I have a simple form with text input and text area, but when I submit it the variables seems to be array items instead of just string values?

the form

<%= 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 %>

console output

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"=>""}

what i would like it to be
instead of

"epos"=>["text box value"]

i want it to return

"epos"=>"text box value"

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby