Frage

I'm using awesome_nested_set to display categories and subcategories. I've used this

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

But in this case it adds - to show the nested nature of subcategories. I just want to use spaces instead of a - hyphens. Please help.

War es hilfreich?

Lösung

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

i put the & nbsp; character instead of - and set the string as .html_safe

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top