diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 9b72945e5..1364d3971 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -11,6 +11,12 @@ class PeopleController < ApplicationController def index @aspect = :search params[:q] ||= params[:term] + + if params[:q][0] == 35 || params[:q][0] == '#' + redirect_to "/p/?tag=#{params[:q].gsub("#", "")}" + return + end + limit = params[:limit] || 15 @people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => limit diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index a0c5f775c..b279ce536 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -50,6 +50,11 @@ describe PeopleController do get :index, :q => "Korthsauce" response.should_not be_redirect end + + it 'goes to a tag page if you search for a hash' do + get :index, :q => '#babies' + response.should redirect_to('/p/?tag=babies') + end end describe "#show performance", :performance => true do