Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用简单的表单 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 - 集合选择输入