2013-03-05 49 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} 
相关问题