簡體   English   中英

Rails:以簡單形式選擇集合

[英]Rails: Collection select in simple form

我正在使用簡單形式的gem,我想知道您如何執行collection_select? 我知道您可以進行選擇,但是如何從集合中獲取值呢?

因此,例如,您將如何以一種簡單的形式執行此操作:

collection_select(:post, :author_id, Author.all, :id, :name_with_initial, :prompt => true)

謝謝

您可以這樣做:

collection_select(:post, :author, Author.all, :id, :name_with_initial)

看看SimpleForm-集合選擇輸入

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM