should sort by Page#depth so slug parts are in the right order

This commit is contained in:
Paul 2011-08-29 16:17:18 +03:00
parent ff901ca3d3
commit acd731347c

View File

@ -69,7 +69,7 @@ class Page
if self.index? || self.not_found? if self.index? || self.not_found?
self.slug self.slug
else else
slugs = self.self_and_ancestors.map(&:slug) slugs = self.self_and_ancestors.sort_by(&:depth).map(&:slug)
slugs.shift unless slugs.size == 1 slugs.shift unless slugs.size == 1
File.join slugs File.join slugs
end end