如何从控制器中的 f.select 标记中获取值。这是我的erb代码
<td>
<%= f.text_field :startdate , :id => "from", :placeholder => "Start Date"%>
</td>
<td>
<%= f.select :repetitive_task, options_for_select(["Every Day","Every Week", "Every Month"]), {:prompt => 'None'}, {:id => "select1"} %>
</td>
这是我的控制器——
def create
@micropost = current_user.microposts.build(params[:micropost])
if params[:repetitive_task] == "Every Day"
@micropost.targetdate = params[:startdate]
elsif params[:repetitive_task] == "Every Week"
@micropost.targetdate = params[:startdate] + 7
elsif params[:repetitive_task] == "Every Month"
@micropost.targetdate = params[:startdate] + 30
else
end
if @micropost.save
flash[:success] = "Task created!"
redirect_to root_url
else
render 'static_pages/index'
end
单击提交按钮时未获取值。请帮忙