diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 9b72945e591fc6227ad86a4c3c674498d7e196f3..1364d3971ee4dabb2ea7ddd7e72a9e36e0de5079 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 a0c5f775c24c84bd05a8aae007199baedacae0a8..b279ce5361828afdda521fc56873828a610c86cb 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