blob: f3a3206153ce75c327a6930ed22c5b9cb6a33e67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
class SearchController < ApplicationController
before_action :authenticate_user!
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
private
def search_query
@search_query ||= (params[:q] || params[:term] || '').strip
end
end
|