Commit 43a4ef000c7f51e5b068a4d4dc4d4c88da66f80a
Committed by
Rodrigo Souto
1 parent
014ca19f
Exists in
api_tasks
and in
4 other branches
Api fix to get the reverse order of the comments
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/api/v1/comments.rb
@@ -18,9 +18,9 @@ module API | @@ -18,9 +18,9 @@ module API | ||
18 | conditions = make_conditions_with_parameter(params) | 18 | conditions = make_conditions_with_parameter(params) |
19 | 19 | ||
20 | if params[:reference_id] | 20 | if params[:reference_id] |
21 | - 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") | 21 | + 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) |
22 | else | 22 | else |
23 | - comments = environment.articles.find(params[:id]).comments.find(:all, :conditions => conditions, :limit => limit, :order => "created_at DESC") | 23 | + comments = environment.articles.find(params[:id]).comments.reorder("created_at DESC").find(:all, :conditions => conditions, :limit => limit) |
24 | end | 24 | end |
25 | present comments, :with => Entities::Comment | 25 | present comments, :with => Entities::Comment |
26 | 26 |