Little refactor on PeopleController#index

This commit is contained in:
Gonzalo Rodriguez 2011-12-03 20:53:41 -02:00
parent fbb17ec1a5
commit c62a9a2e63

View file

@ -19,12 +19,15 @@ class PeopleController < ApplicationController
@aspect = :search @aspect = :search
params[:q] ||= params[:term] || '' params[:q] ||= params[:term] || ''
if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1 if params[:q][0] == 35 || params[:q][0] == '#'
redirect_to tag_path(:name => params[:q].gsub(/[#\.]/, ''), :q => params[:q]) if params[:q].length > 1
return tag_name = params[:q].gsub(/[#\.]/, '')
elsif (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length == 1 redirect_to tag_path(:name => tag_name, :q => params[:q])
flash[:error] = I18n.t('tags.show.none', :name => params[:q]) return
redirect_to :back else
flash[:error] = I18n.t('tags.show.none', :name => params[:q])
redirect_to :back
end
end end
limit = params[:limit] ? params[:limit].to_i : 15 limit = params[:limit] ? params[:limit].to_i : 15