我做了一个表单,但我不知道如何从中收集数据,按下提交按钮后重定向用户添加/ fill.erb文件,这是我的表单:
file: adding/counter.erb
<%= simple_form_for :counter 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 %>
我知道这是一个蹩脚的问题,但我正在研究它几个小时,我不知道该怎么做:/
答案 0 :(得分:1)
我不是很清楚,但听起来你试图设置表单发布到的URL?如果是这样,你应该能够这样做:
<%= simple_form_for :counter, :url => {:controller => "counter", :action => "fill} do |f| %>