0
如何基于从第一个下拉列表中选择的值来填充下拉选项?集合选择基于第一个下拉值选择
我有我的观点在那里,现在我选择产品和颜色下面,但我想限制的颜色选择,所选产品
<td><%= f.collection_select(:product_id, Product.active.all, :id, :name, :prompt => 'Select Product') %></td>
<td><%= f.collection_select(:color_id, Color.all, :id, :name, :prompt => 'Select Color') %></td>
Product has_many :colors
Color has_and_belongs_to_many :products
谢谢。我以前尝试过,但太旧了。在Rails 3和使用jQuery(JS不是我的一杯茶)之前,我忽略了一切。 – Gaelle