From 8a5d96490debc19157bd74d992cbe121bce65c01 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 29 Mar 2018 07:00:29 +0100 Subject: Specify the ordering for revisions And update the show page to use the default scope. --- app/models/govuk_guix/revision.rb | 2 ++ app/views/setup/show.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/models/govuk_guix/revision.rb b/app/models/govuk_guix/revision.rb index 45793b2..c971913 100644 --- a/app/models/govuk_guix/revision.rb +++ b/app/models/govuk_guix/revision.rb @@ -12,5 +12,7 @@ class GovukGuix::Revision < ApplicationRecord self.primary_key = 'commit_hash' + default_scope { order(:created_at).reverse_order } + has_many :mini_environments, foreign_key: 'govuk_guix_revision_id' end diff --git a/app/views/setup/show.html.erb b/app/views/setup/show.html.erb index 6f8be35..4fea193 100644 --- a/app/views/setup/show.html.erb +++ b/app/views/setup/show.html.erb @@ -59,8 +59,8 @@ <% end %> <% end %> - - <% GovukGuix::Revision.order(:created_at).reverse_order.each do |revision| %> + + <% GovukGuix::Revision.all.each do |revision| %> <%= revision.commit_hash %> -- cgit v1.2.3