diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index cc6a63b64..b4cabc546 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -63,14 +63,14 @@ private end def index_by_post - @posts = Post.commented_before(Time.now).tag_match(params[:tags]).paginate(params[:page], :limit => 5) + @posts = Post.commented_before(Time.now).tag_match(params[:tags]).order("posts.id desc").paginate(params[:page], :limit => 5) respond_with(@posts) do |format| format.html {render :action => "index_by_post"} end end def index_by_comment - @comments = Comment.search(params[:search]).paginate(params[:page]) + @comments = Comment.search(params[:search]).order("comments.id desc").paginate(params[:page]) respond_with(@comments) do |format| format.html {render :action => "index_by_comment"} end diff --git a/app/models/comment.rb b/app/models/comment.rb index a2aca37be..80bb9196c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -11,7 +11,7 @@ class Comment < ActiveRecord::Base module SearchMethods def recent - order("comments.id desc").limit(6) + reorder("comments.id desc").limit(6) end def body_matches(query) @@ -51,7 +51,7 @@ class Comment < ActiveRecord::Base end if params[:creator_name].present? - q = q.for_user_name(params[:creator_name]) + q = q.for_creator_name(params[:creator_name]) end if params[:creator_id].present? diff --git a/app/views/comments/index_by_post.html.erb b/app/views/comments/index_by_post.html.erb index bb28df264..0f7ea4af1 100644 --- a/app/views/comments/index_by_post.html.erb +++ b/app/views/comments/index_by_post.html.erb @@ -11,7 +11,7 @@