diff --git a/app/models/snippet.rb b/app/models/snippet.rb index acffc76c..44cb8887 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -22,6 +22,8 @@ class Snippet < ActiveRecord::Base :presence => true, :length => { :within => 0..10000 } + scope :fresh, order("created_at DESC") + def self.content_types [ ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index fe5e6170..3f261000 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -8,7 +8,7 @@ %th Title %th File name %th - = render @snippets + = render @snippets.fresh :javascript $('.delete-snippet').live('ajax:success', function() { $(this).closest('tr').fadeOut(); });