Reputation: 48453
I use this query to database:
Category.all.each { |c| c.ancestry = c.ancestry.to_s + (c.ancestry != nil ? "/" : '') + c.id.to_s
}.sort {|x,y| x.ancestry <=> y.ancestry
}.map{ |c| [" A " * (c.depth - 1) + c.name,c.id]}
Before the letter A I want to add a few white chars (because of indentation), but if I tried to add just " "
(empty space) or \t
, it doesn't work.
How to do that?
Upvotes: 1
Views: 166
Reputation: 19489
I assume this is on a webpage. If so, more than 1 space in HTML is ignored. Instead, you need to use CSS to space each category, or use
instead of spaces.
Upvotes: 1