Class: SearchController

Inherits:
ApplicationController show all
Defined in:
app/controllers/search_controller.rb

Instance Method Summary collapse

Instance Method Details

#searchObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/search_controller.rb', line 4

def search
  if search_query.starts_with?('#')
    if search_query.length > 1
      respond_to do |format| 
        format.json {redirect_to tags_path(:q => search_query.delete("#."))}
        format.any {redirect_to tag_path(:name => search_query.delete("#."))}
      end
    else
      flash[:error] = I18n.t('tags.show.none', :name => search_query)
      redirect_to :back
    end
  else
    redirect_to people_path(:q => search_query)
  end 
end