2012-06-29 3 views
1

간단한 형태의 보석을 사용하고 있으며 collection_select를 어떻게 사용하고 있는지 궁금합니다. 선택을 할 수 있다는 것을 알고 있지만 컬렉션에서 값을 얻는 방법은 무엇입니까?레일 : 컬렉션을 단순한 형태로 선택하십시오.

따라서 예를 들어, 당신은 어떻게 간단한 형태로 이런 짓을 했을까 :

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

감사

답변

5

당신은 이런 식으로 할 것 :

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

SimpleForm - Collection Select Input에서보세요

+0

올바르지 않습니다. 코드를 다음과 같이 조정하십시오 :'collection_select (: post, : author, Author.all, : id, : name_with_initial)' – DJTripleThreat

관련 문제