I've been trying to figure out how to post a string into an array from a user input text field that is part of a form. The push and << methods work fine over the console, but I couldn't manage to save any string data into arrays from my forms. It always reports a type mismatch like this:
Attribute was supposed to be a Array, but was a String.
What is the appropriate way to deal with this ?
EDIT code example:
the array:
serialize(:name, Array)
Let's say that the form contains just a simple text field, nothing else. How would I store the input data into the array above ? Basically what's the correct format of this piece of code:
<%= form_tag(grids_path , method: "post") do %>
<table id="grid">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= text_field(:grid, :name) %></td>
</tr>
</tbody>
</table>
<%= submit_tag("Save") %>
<% end %>