lib/multi_site/page_extensions.rb in trusty-multi-site-extension-1.2.0 vs lib/multi_site/page_extensions.rb in trusty-multi-site-extension-1.2.1
- old
+ new
@@ -13,16 +13,20 @@
class << base
def find_by_path(path, live=true)
root = homepage
raise Page::MissingRootPageError unless root
+ path = root.path if clean_path(path) == "/"
root.find_by_path(path, live)
end
def current_site
@current_site ||= Site.default
end
def current_site=(site)
@current_site = site
+ end
+ def clean_path(path)
+ "/#{ path.to_s.strip }/".gsub(%r{//+}, '/')
end
end
end
module InstanceMethods
\ No newline at end of file