#3287 using reorder instead of order for newer, older

This commit is contained in:
Alex Connor 2012-05-20 18:21:34 -05:00
parent 9c2c135731
commit fe984eb426

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)