Commit 0774d367a6f3f3003e649be8eb9778567b02b8dc
1 parent
32f20c90
Exists in
theme-brasil-digital-from-staging
and in
9 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 | ... | ... |