raven/app/routes/search.rb

20 lines
460 B
Ruby
Raw Permalink Normal View History

class Raven
class SearchController
get '/' do
search_parameter = params[:query]
items = Item.where(Sequel.ilike(:name, "%#{search_parameter}%")).all()
licenses = License.where(Sequel.ilike(:name, "%#{search_parameter}%")).all()
results = items.concat(licenses)
erb :'search/list', :locals => {
:title => 'Search Results',
:results => results,
:query => search_parameter
}
end
end
end