Commit 64dd29d

mo khan <mo@mokhan.ca>
2015-02-10 03:00:21
display created at for agents and sort by created_at descending.
1 parent 99eb8e0
Changed files (2)
app
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
app/views/agents/index.html.erb
@@ -9,15 +9,16 @@
       <thead>
         <tr>
           <th>Hostname</th>
-          <th colspan="4"></th>
+          <th>Created At</th>
+          <th colspan="3"></th>
         </tr>
       </thead>
       <tbody>
         <% @agents.each do |agent| %>
           <tr>
-            <td><%= agent.hostname %></td>
+            <td><%= link_to agent.hostname, agent_path(agent) %></td>
+            <td><%= agent.created_at %></td>
             <td><%= link_to 'Events', agent_events_path(agent) %></td>
-            <td><%= link_to 'Show', agent %></td>
             <td><%= link_to 'Edit', edit_agent_path(agent) %></td>
             <td><%= link_to 'Destroy', agent, method: :delete, data: { confirm: 'Are you sure?' } %></td>
           </tr>