我想用一个按钮提交两个表单。
下面如果我的代码: -
率.rb
belongs_to :target, :polymorphic => true
belongs_to :location
位置.rb
has_many :rates
事件.rb
has_many :rates, :as => :target
form.html.haml
= form_for [@event, @rate] do |form|
%ul
%li= form.radio_button :rate, "Excellent"
%li Excellent
%li= form.radio_button :rate, "Okay"
%li Okay
%li= form.radio_button :rate, "Poorly organized"
%li Poorly organized
%li= form.radio_button :rate, "Didn't happen"
%li Didn't happen
=form_for [@event.location, @rate] do |form|
%ul
%li= form.radio_button :rate, "Excellent"
%li Excellent
%li= form.radio_button :rate, "Okay"
%li Okay
%li= form.radio_button :rate, "Nothing special"
%li Nothing special
如何才能做到这一点 ?