Answer the question
In order to leave comments, you need to log in
How to pass information from a form as an object?
In rails, you can collect information from several fields into an array in this way:
view:
<%= text_field_tag 'dogs[]' %>
<%= text_field_tag 'dogs[]' %>
puts params[:dogs] # => ["Bailey", "Max"]
{
"ru": "собака",
"en": "dog"
}
Answer the question
In order to leave comments, you need to log in
<%= text_field_tag 'dogs[ru]' %>
<%= text_field_tag 'dogs[en]' %>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question