2011-07-09 15 views
1

をsimple_formかformstaticするフォームヘルパーを翻訳:私は私のモデルでこれを持って

collection_select(:person, :relationship_status, Person::RELATIONSHIP_STATUSES, :to_s) 

そして私はsimple_formにそれを翻訳したいと思います:

ビューで
class Person < ActiveRecord::Base 
    RELATIONSHIP_STATUSES = [ 
    "single", 
    "in a relationship", 
    "together", 
    "it's complicated" 
    ] 

    validates :relationship_status, :inclusion => RELATIONSHIP_STATUSES 
end 

これ。それは可能ですか?

答えて

0

私は右のあなたを理解している場合、それは(それがformtasticのためです)簡単です:

<%= form.input :relationship_status, :as => :select, :collection => Person::RELATIONSHIP_STATUSES %> 
+0

あなたは必要ありません:あなたは選択のコレクションを使用する場合は、オプションとして – rafaelfranca

関連する問題