[問題] RoR下如何使用select撈資料呢?
環境:
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
03/10 18:36, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章