blob: 6c2f434748c360ca9fd67194189b3775e2dd1cb8 (
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] || ''
end
end
|