【发布时间】:2026-01-04 01:40:02
【问题描述】:
我想将名为“adding”的表单中的数据存储在一个数组中——我想根据这个数组中的数据生成其他表单,所以我认为我不必在这里使用数据库(我错了吗?) .我应该如何在“添加”的模型中定义一个数组?这就是我的表单的样子:
<h2>Add new data</h2>
Please select, what kind of data you want to add:<br /><br />
<%= simple_form_for :adding do |f| %>
<%= f.input :first_name, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :last_name, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :city, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :postal, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :street, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :job, :collection => 0..10 , :prompt => "How many?" %>
<%= f.input :role, :collection => 0..10 , :prompt => "How many?" %>
<%= f.button :submit, 'next step', :style => "margin-top: 20px;" %>
<% end %>
请帮忙:/
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 model-view-controller