开发者

Basic rails collection select question

A card can have one of many card_types. There are two models, card and card_type, where card_type is an [id, card_type_desc]开发者_如何学JAVA pairing.

When you define a new card, you have to pick a card-type from a drop down list.

I have the list rendering correctly with the below collection_select box, but the new card.card_type_id field is NULL. How do you set it to the value from the list?

<%= collection_select(:card_type, :id, @card_types, :id, :card_type_desc) %> 

Thanks in advance.


I am guessing, It should be...

<%= collection_select(:card, :card_type_id, @card_types, :id, :card_type_desc) %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜