From c62a9a2e638fb395e7cc5db8986ea237d4088e93 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 3 Dec 2011 20:53:41 -0200 Subject: [PATCH] Little refactor on PeopleController#index --- app/controllers/people_controller.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index a23c69735..dc7e1416b 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -19,12 +19,15 @@ class PeopleController < ApplicationController @aspect = :search params[:q] ||= params[:term] || '' - if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1 - redirect_to tag_path(:name => params[:q].gsub(/[#\.]/, ''), :q => params[:q]) - return - elsif (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length == 1 - flash[:error] = I18n.t('tags.show.none', :name => params[:q]) - redirect_to :back + if params[:q][0] == 35 || params[:q][0] == '#' + if params[:q].length > 1 + tag_name = params[:q].gsub(/[#\.]/, '') + redirect_to tag_path(:name => tag_name, :q => params[:q]) + return + else + flash[:error] = I18n.t('tags.show.none', :name => params[:q]) + redirect_to :back + end end limit = params[:limit] ? params[:limit].to_i : 15