From 64dd29d70ddda6f4927e9352e3e90c4f87b5041a Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 9 Feb 2015 20:00:21 -0700 Subject: display created at for agents and sort by created_at descending. --- app/controllers/agents_controller.rb | 2 +- app/views/agents/index.html.erb | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/agents_controller.rb b/app/controllers/agents_controller.rb index 4acef9d..dc2717a 100644 --- a/app/controllers/agents_controller.rb +++ b/app/controllers/agents_controller.rb @@ -1,6 +1,6 @@ class AgentsController < ApplicationController def index - @agents = Agent.all + @agents = Agent.all.order(created_at: :desc) end def show diff --git a/app/views/agents/index.html.erb b/app/views/agents/index.html.erb index 3a6b738..75adfdb 100644 --- a/app/views/agents/index.html.erb +++ b/app/views/agents/index.html.erb @@ -9,15 +9,16 @@ Hostname - + Created At + <% @agents.each do |agent| %> - <%= agent.hostname %> + <%= link_to agent.hostname, agent_path(agent) %> + <%= agent.created_at %> <%= link_to 'Events', agent_events_path(agent) %> - <%= link_to 'Show', agent %> <%= link_to 'Edit', edit_agent_path(agent) %> <%= link_to 'Destroy', agent, method: :delete, data: { confirm: 'Are you sure?' } %> -- cgit v1.2.3