2013-12-17 325 views
0

我使用awesome_nested_set来显示类别和子类别。我用这个定制awesome_nested_set默认下拉选择框

<%= f.select :parent_id, nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" }, {:include_blank => 'Base Category'},{:class => "form-control"} %> 

但在这种情况下,增加了-显示子类别的嵌套性质。我只想使用空格而不是-连字符。请帮忙。

回答

1
<%= f.select :parent_id, nested_set_options(Category, @category) {|i| "#{'&nbsp;' * i.level} #{i.name}".html_safe }, {:include_blank => 'Base Category'},{:class => "form-control"} %> 

我把& nbsp;字符而不是-,并设置字符串作为.html_safe

+0

谢谢哥们,你解决了我的问题。 – RSB