Fetch updates in reverse chronological order by default.

This commit is contained in:
Miles Gould committed 2012-11-09 10:13:16 +00:00
1 parent ed896dd7a5
commit e6eb30fbbf
2 files changed
+6 -1

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
class Update < ActiveRecord::Base
attr_accessible :body, :subject, :user_id
belongs_to :user
default_scope order("created_at desc")
end
+5 -1
View File
@@ -1,5 +1,9 @@
require 'spec_helper'
describe Update do
pending "add some examples to (or delete) #{__FILE__}"
it "should be sorted in reverse order" do
Update.create! :subject => "first entry", :body => "blah", :user_id => 1
Update.create! :subject => "second entry", :body => "blah", :user_id => 1
Update.first.subject.should == "second entry"
end
end