带有收集的轨道中的相关选择框

时间:2011-04-14 23:34:38

标签: javascript jquery ruby-on-rails

我有三个选择列表填充收集,但来自相同的“产品”表:

    <p>
            <span>Categoria:</span><%= select :search, :search1, [["Seleccionar", "none"]] + Product.all(:group => "category", :order => "category").collect {|a| [a.category, a.category]} %>
          </p>
           <p>
           <span>Subcategoria:</span><%= select :search, :search2, [["Seleccionar", "none"]] + Product.all(:group => "subcategory", :order => "subcategory").collect {|b| [b.subcategory, b.subcategory]} %>
           </p>
            <p>
            <span>Subcubategoria:</span><%= select :search, :search3, [["Seleccionar", "none"]] + Product.all(:group => "subsubcategory", :order => "subsubcategory").collect {|c| [c.subsubcategory, c.subsubcategory]} %>
</p>

所以我喜欢彼此依赖。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您的问题有点令人困惑,但如果您想根据之前选择框中的选择更新某些选择框,请查找observe_field(以及replicating its behaviour in Rails 3的方法)一些指导。