mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-27 11:14:31 -04:00
Fetch updates in reverse chronological order by default.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class Update < ActiveRecord::Base
|
||||
attr_accessible :body, :subject, :user_id
|
||||
belongs_to :user
|
||||
default_scope order("created_at desc")
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user