使用formtastic如何在自定义类中包装标签输出?

时间:2013-03-05 00:35:25

标签: ruby-on-rails formtastic

现在我正在输出带有formtastic的3个单选按钮。

<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>

我想在自定义类中包装“medium”。我怎么能这样做?

找出答案:

必须使用member_label

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

1 个答案:

答案 0 :(得分:1)

想出来:

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