aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-03-29 07:00:29 +0100
committerChristopher Baines <mail@cbaines.net>2018-04-03 21:58:55 +0100
commit8a5d96490debc19157bd74d992cbe121bce65c01 (patch)
tree9c987c71638bf60623d72dc1b5432d9acab84235 /app
parentaf6f2b6157e2a82ea45607b246ff320b0bf6413f (diff)
downloadgovuk-mini-environment-admin-8a5d96490debc19157bd74d992cbe121bce65c01.tar
govuk-mini-environment-admin-8a5d96490debc19157bd74d992cbe121bce65c01.tar.gz
Specify the ordering for revisions
And update the show page to use the default scope.
Diffstat (limited to 'app')
-rw-r--r--app/models/govuk_guix/revision.rb2
-rw-r--r--app/views/setup/show.html.erb4
2 files changed, 4 insertions, 2 deletions
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 @@
</a>
<% end %>
<% end %>
-
- <% GovukGuix::Revision.order(:created_at).reverse_order.each do |revision| %>
+
+ <% GovukGuix::Revision.all.each do |revision| %>
<a href="<%= govuk_guix_revision_path(revision) %>" class="list-group-item">
<span class="badge" style="font-family: monospace;">
<%= revision.commit_hash %>