2011-10-21 63 views
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 

回答

相关问题