more bugfixes for: Feature/rails3 broken links in deep neested pages

the original pull request was merged (and cant be reopened). So this is a new pull request for the same bug with more fixes :)