Commit 7c6f7342e6dd5d721b1af42563196b8b2db7d440

Authored by Evandro Jr
2 parents 25c4a5f6 0774d367

Merge branch 'api' into stable

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  
... ...