From 43a4ef000c7f51e5b068a4d4dc4d4c88da66f80a Mon Sep 17 00:00:00 2001 From: Evandro Jr Date: Tue, 11 Nov 2014 17:02:59 -0300 Subject: [PATCH] Api fix to get the reverse order of the comments --- lib/api/v1/comments.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api/v1/comments.rb b/lib/api/v1/comments.rb index e6c52a0..42c6f4b 100644 --- a/lib/api/v1/comments.rb +++ b/lib/api/v1/comments.rb @@ -18,9 +18,9 @@ module API conditions = make_conditions_with_parameter(params) if params[:reference_id] - comments = environment.articles.find(params[:id]).comments.send("#{params.key?(:oldest) ? 'older_than' : 'newer_than'}", params[:reference_id]).find(:all, :conditions => conditions, :limit => limit, :order => "created_at DESC") + comments = environment.articles.find(params[:id]).comments.send("#{params.key?(:oldest) ? 'older_than' : 'newer_than'}", params[:reference_id]).reorder("created_at DESC").find(:all, :conditions => conditions, :limit => limit) else - comments = environment.articles.find(params[:id]).comments.find(:all, :conditions => conditions, :limit => limit, :order => "created_at DESC") + comments = environment.articles.find(params[:id]).comments.reorder("created_at DESC").find(:all, :conditions => conditions, :limit => limit) end present comments, :with => Entities::Comment -- libgit2 0.21.2