[問題] RoR下如何使用select撈資料呢?

看板Ruby作者 (To you)時間15年前 (2010/03/08 21:23), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
環境: Ruby 1.8.7 & Rails 2.2.2 狀況: 我在想用form_helper做到一件事, 動態撈資料 例如: class Brand < ActiveRecord::Base has_many :PCs end class PC < ActiveRecord::Base belongs_to :brand has_many :orders end class Order < ActiveRecord::Base belongs_to :PC end 我在Order的Add View裡可以使用 <%= collection_select(:sheet, :PC_id, PC.all, :id, :name, {:include_blank => true}) %> 可是資料多的時侯就要翻好幾頁才找的到資料 請問要如何做先選擇品牌, 選完之後再選擇相關的PC呢?(感覺像是兩階段的select) 感謝大大們賜教? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.127.157.91

03/10 18:36, , 1F
請參照:join
03/10 18:36, 1F
文章代碼(AID): #1BbFff-Q (Ruby)
文章代碼(AID): #1BbFff-Q (Ruby)