diff --git a/app/models/post.rb b/app/models/post.rb index b788264ff..c682a5d5a 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -72,11 +72,11 @@ class Post < ActiveRecord::Base } def self.next(post) - where("posts.created_at > ?", post.created_at).order('posts.created_at ASC').last + where("posts.created_at > ?", post.created_at).order('posts.created_at ASC').first end def self.previous(post) - where("posts.created_at < ?", post.created_at).first + where("posts.created_at < ?", post.created_at).order('posts.created_at DESC').first end def self.visible_from_author(author, current_user=nil)