display recent snippets at top
This commit is contained in:
parent
5e584ee626
commit
000c032482
|
@ -22,6 +22,8 @@ class Snippet < ActiveRecord::Base
|
||||||
:presence => true,
|
:presence => true,
|
||||||
:length => { :within => 0..10000 }
|
:length => { :within => 0..10000 }
|
||||||
|
|
||||||
|
scope :fresh, order("created_at DESC")
|
||||||
|
|
||||||
def self.content_types
|
def self.content_types
|
||||||
[
|
[
|
||||||
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
|
".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
%th Title
|
%th Title
|
||||||
%th File name
|
%th File name
|
||||||
%th
|
%th
|
||||||
= render @snippets
|
= render @snippets.fresh
|
||||||
:javascript
|
:javascript
|
||||||
$('.delete-snippet').live('ajax:success', function() {
|
$('.delete-snippet').live('ajax:success', function() {
|
||||||
$(this).closest('tr').fadeOut(); });
|
$(this).closest('tr').fadeOut(); });
|
||||||
|
|
Loading…
Reference in a new issue