fix ordering for logged out users

This commit is contained in:
Maxwell Salzberg 2012-02-27 19:15:45 -08:00
parent 3d48dc4fb0
commit d80afc64ec

View file

@ -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)