【发布时间】:2013-11-26 00:21:36
【问题描述】:
我认为我想做的在理论上很简单,但我很难用语言来寻找解决方案。
在我的比赛表格上,我有一个收藏选择-
<div class="form-group">
<%= f.label :matchup_id, 'Select Matchset' %>
<%= f.collection_select(:matchset_id, Matchset.where("starttime > ?", Time.now), :id, :name, { :prompt => true } ) %>
对于他们在此处选择的任何匹配集,我想将该匹配集的开始时间传递给在此竞赛模型上也称为开始时间的字段。
编辑澄清:我想根据用户在集合选择中的选择将第二个值从 Matchset 模型传递到 Contest 模型。因此,如果用户在集合选择中选择 matchset 1,我想将 1 作为 matchset_id 传递给 Contest,但我也想从 matchset 1 中获取开始时间并将其作为我正在创建的竞赛记录的开始时间传递。对新手有什么建议吗?
【问题讨论】:
标签: ruby-on-rails forms parameters simple-form