mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Sort by published_at
This commit is contained in:
parent
46de026234
commit
b1197df490
1 changed files with 3 additions and 3 deletions
|
@ -2,11 +2,11 @@ class SearchController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@show_search_result = params[:q].present?
|
@show_search_result = params[:q].present?
|
||||||
papers_found = if @show_search_result
|
papers_found = if @show_search_result
|
||||||
Paper.search(params[:q])
|
Paper.search(params[:q]).records
|
||||||
else
|
else
|
||||||
Paper.order(published_at: :desc)
|
Paper
|
||||||
end
|
end
|
||||||
@papers_count = @show_search_result ? papers_found.results.total : papers_found.count
|
@papers_count = @show_search_result ? papers_found.results.total : papers_found.count
|
||||||
@papers = papers_found.page(params[:page])
|
@papers = papers_found.order(published_at: :desc).page(params[:page])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue