2016-12-02 17 views
1

私はitem_wrapper_classにしようとしたが、それ、これは以下のようなHTMLを生成協会タイプオプションの関連付けをsimple_form_forするカスタムクラスを追加 - Railsの

= f.association :type, :collection =>version_name,:label => "Application type:", :selected =>'', :item_wrapper_class => 'lbl_type' 

<div class="control-group select optional"> 
<label class="select optional control-label" for="subscription_type_id">Application type:</label> 
<div class="controls"> 
<select class="select optional control-label" id="subscription_type_id" name="subscription[type_id]"> 
<option value="4">Type 1</option> 
<option value="5">Type 2</option> 
</select> 
</div> 
</div> 

をsimple_form_forを使用していますが動作していない

コントロールラベルと入力フィールドに特定のカスタムクラスを追加する方法

これを達成する方法はありますか?

答えて

1

下記のようにinput_html属性を試してください。

= f.association :type, :collection =>version_name,:label => "Application type:", :selected =>'', input_html: { class: 'yourclass'} 
+1

正常に動作しています... – user2681579

関連する問題