mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-23 08:03:14 +01:00
12 lines
381 B
Ruby
12 lines
381 B
Ruby
class SearchController < ApplicationController
|
|
def index
|
|
@show_search_result = params[:q].present?
|
|
papers_found = if @show_search_result
|
|
Paper.search(params[:q])
|
|
else
|
|
Paper.order(published_at: :desc)
|
|
end
|
|
@papers_count = @show_search_result ? papers_found.results.total : papers_found.count
|
|
@papers = papers_found.page(params[:page])
|
|
end
|
|
end
|