2012-02-07 11 views
0

私はこのsimple_formSimple_formスタイルcollection_labelの

<%= simple_form_for(@order) do |f| %> 
        <%= f.error_notification %> 
        <%= f.association :orderstatus, :label => false, :include_blank => false, :input_html => { :class => 'order-status' } , :as => :radio, :label_html => { :style => "background-color:black;" } %> 
        <%= f.button :submit, :value => 'Update', :class => 'button grey small' %> 

       <% end %> 

を持っており、それは、この作成されます。私も、私は、各ステータスのしたい背景色の進コードであるフィールドcolorを持っているデータベースでhttp://d.pr/9Bqdを。この16進コードを各背景ラベルの色にどのように渡すか考えてみましょうか?私は何時間も試しました。そうでない場合

答えて

0

あなたは...このようにそれを渡す

# assuming "hex" is stored in the order model. Any variable should work 
:label_html => { :style => "background-color:##{@order.hex};" } 

を試してみましたが、あなたの結果

で応答してください
関連する問題