collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})public
例如,在rails中解釋collection_select 4
collection_select(:post, :author_id, Author.all, :id, :name_with_initial, prompt: true)
在這個幫手 - 請解釋一下,什麼是object
並詳細method
? :post
是模型名稱,而:author_id
是模型中的字段名稱,或者它們是標記名稱。
它們可以是我想要的任何東西,不一定是:post
和author_id
,而不是:post123
或auth_id
。它會完全好嗎?
請詳細解釋。在此先感謝