Commit c46ace113da5bbf8c007500ab458e8dbf32432ea
Committed by
Rodrigo Souto
1 parent
9c9056c8
Exists in
master
and in
29 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 | 18 | conditions = make_conditions_with_parameter(params) |
| 19 | 19 | |
| 20 | 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 | 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 | 24 | end |
| 25 | 25 | present comments, :with => Entities::Comment |
| 26 | 26 | ... | ... |