Commit 6d1fd8fe

mo k <mo@mokhan.ca>
2012-09-13 12:40:11
display the newest tutorials first.
1 parent 38ac0a7
Changed files (2)
app
app/controllers/tutorials_controller.rb
@@ -2,7 +2,7 @@ class TutorialsController < ApplicationController
   before_filter :authenticate_user!, :except => [:show, :index]
 
   def index
-    @tutorials = Tutorial.all
+    @tutorials = Tutorial.all.reverse
   end
 
   def show
app/views/tutorials/index.html.erb
@@ -17,7 +17,7 @@
         <div class="thumbnail">
           <img src="<%= tutorial.image_url %>" />
           <div class="caption">
-            <h3><%= tutorial.heading %></h3>
+            <h3><%= tutorial.heading %> <small><%= tutorial.created_at.to_s :foomat %></small></h3>
             <p><%= tutorial.description %></p>
             <p><a class="btn btn-primary" href="<%= tutorial.url %>">Read</a> <a class="btn" href="<%= url_for tutorial %>">View</a></p>
           </div>