This commit is contained in:
Toks
2013-05-11 16:01:19 -04:00
parent 7c795c61e6
commit 3ee20d2bb7
5 changed files with 21 additions and 3 deletions

View File

@@ -67,8 +67,12 @@ class WikiPagesController < ApplicationController
def show_or_new
@wiki_page = WikiPage.find_by_title(params[:title])
if @wiki_page
redirect_to wiki_page_path(@wiki_page)
tag_alias = TagAlias.where("status = 'active' and antecedent_name = ?", params[:title]).first
if tag_alias && params[:no_redirect].blank?
redirect_to show_or_new_wiki_pages_path(:title => tag_alias.consequent_name, :redirected_from => params[:title])
elsif @wiki_page
redirect_to wiki_page_path(@wiki_page, :redirected_from => params[:redirected_from])
else
@wiki_page = WikiPage.new(:title => params[:title])
respond_with(@wiki_page)