Class: Interpret::SearchController

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

Instance Method Summary collapse

Instance Method Details

#performObject



3
4
5
6
7
8
# File 'app/controllers/interpret/search_controller.rb', line 3

def perform
  t = Interpret::Translation.arel_table
  search_key = params[:key].split(" ").map{|x| "%#{CGI.escape(x)}%"}
  search_value = params[:value].split(" ").map{|x| "%#{CGI.escape(x)}%"}
  @translations = Interpret::Translation.locale(I18n.locale).where(t[:key].matches_all(search_key).or(t[:value].matches_all(search_value))  )
end