notebook/app/controllers/search_controller.rb
2018-10-31 16:27:04 -05:00

15 lines
321 B
Ruby

class SearchController < ApplicationController
before_action :authenticate_user!
def results
@query = params[:q]
@matched_attributes = Attribute
.where(user_id: current_user.id)
.where('value ILIKE ?', "%#{@query}%")
.order(:entity_type, :entity_id)
@seen_result_pages = {}
end
end