2013-03-05 14 views
2

現在我輸出3個單選按鈕和formtastic。使用formtastic如何在自定義類中包裝標籤輸出?

<label for="exercise_log_entries_attributes_0_difficulty_medium"> 
<input checked="checked" class="custom radio" data-placeholder="Difficulty" id="exercise_log_entries_attributes_0_difficulty_medium" name="exercise[log_entries_attributes][0][difficulty]" type="radio" value="Medium"> 
Medium 
</label> 

我想在自定義類中包裝「中」。我怎樣才能做到這一點?

想出答案:

不得不使用member_label

member_label: Proc.new {|a| "<span class='custom radio'>#{a}</span>".html_safe} 
+0

可你嘗試通過'標籤: '

Medium
' .html_safe'。不知道它會owrk雖然 – jvnill 2013-03-05 03:22:03

+0

這爲整個包裝而不是個別部分創建了一個標籤/圖例。 – 2013-03-05 03:55:10

+0

你可以在你的問題中包含你的formtastic代碼嗎? – jvnill 2013-03-05 03:55:58

回答

1

想通了:

member_label: Proc.new {|a| "<span class='custom radio'>#{a}</span>".html_safe} 
相關問題