Add latest added tracks list on the home page

This commit is contained in:
Thibault Jouan
2011-07-27 21:42:33 +00:00
parent b39bc2d6da
commit 46abe07268
8 changed files with 46 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
class HomeController < ApplicationController
def index
@playlists = Playlist.all
@tracks = Track.latest
end
end

View File

@@ -15,4 +15,8 @@ class Track < ActiveRecord::Base
end
save!
end
def self.latest
Track.order('created_at DESC')
end
end

View File

@@ -2,3 +2,6 @@
%ul
- @playlists.each do |p|
%li= p.name
%ul
- @tracks.each do |t|
%li= t.name