From 58816aef5f325ee521d7a966bd59f7fb0db50532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 21 Mar 2019 17:12:03 +0100 Subject: [PATCH] Fix legislation process feed order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to add an ORDER BY clause; not doing so was causing different processes to show up sometimes. As mentioned in the PostgreSQL manual: > Because the order of the rows in the database table is unpredictable, > when you use the LIMIT clause, you should always use the ORDER BY > clause to control the order of rows. If you don’t do so, you will get > an unpredictable result set. --- app/models/widget/feed.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/widget/feed.rb b/app/models/widget/feed.rb index eacd79329..997f9e8b6 100644 --- a/app/models/widget/feed.rb +++ b/app/models/widget/feed.rb @@ -31,7 +31,7 @@ class Widget::Feed < ActiveRecord::Base end def processes - Legislation::Process.open.published.limit(limit) + Legislation::Process.open.published.order("created_at DESC").limit(limit) end end \ No newline at end of file