我的控制器中有一个创建关联记录的方法:
def updating_rating
rr = ProductRecommendation.new(:rating_id => rating_set.id, :recommendation_id => r.id)
rr.save!
end
我的路线设置为:
match "/recommendations/updating_rating" => "recommendation#updating_rating", :as => 'update'
在我看来,我有:
<div>
<%= form_tag(update_url, :method => :post) do %>
<%= radio_button_tag(:rating_id, '1', :recommendation_id => rec.recommendation.id) %>
<%= radio_button_tag(:rating_id, '2', :recommendation_id => rec.recommendation.id) %>
<%= radio_button_tag(:rating_id, '3', :recommendation_id => rec.recommendation.id) %>
<% end %>
</div>
这仅将 rating_id 作为值传递。如何将 rating_id + Recommendation_id 都传递给我的控制器方法。