Merge pull request #3288 from agconnor/next-post-reorder

#3287 using reorder instead of order for newer, older
This commit is contained in:
Maxwell Salzberg 2012-05-20 23:43:57 -07:00
commit 4819850c92

View file

@ -42,11 +42,11 @@ class Post < ActiveRecord::Base
}
def self.newer(post)
where("posts.created_at > ?", post.created_at).order('posts.created_at ASC').first
where("posts.created_at > ?", post.created_at).reorder('posts.created_at ASC').first
end
def self.older(post)
where("posts.created_at < ?", post.created_at).order('posts.created_at DESC').first
where("posts.created_at < ?", post.created_at).reorder('posts.created_at DESC').first
end
def self.visible_from_author(author, current_user=nil)