raven/lib/routes/search.rb

16 lines
415 B
Ruby
Raw Normal View History

2022-12-11 22:27:45 -05:00
namespace '/search' do
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)
2022-12-11 22:27:45 -05:00
erb :'search/list', :locals => {
:title => 'Search Results',
:results => results,
2022-12-11 22:27:45 -05:00
:query => search_parameter
}
end
end