diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index ebcc9f92..088d07f5 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -3,8 +3,7 @@ module Admin load_and_authorize_resource def index - @comments = Comment.accessible_by(current_ability).order(created_at: :desc).group_by { |comment| comment.commentable.conference } - @another_comments = Hash[@comments.map{|conference, comments| [conference, comments.group_by {|comment| comment.commentable}]}] + @comments = Comment.accessible_by(current_ability).order(created_at: :desc).group_by { |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by {|comment| comment.commentable}]}.to_h end end end diff --git a/app/views/admin/comments/_all_comments.html.haml b/app/views/admin/comments/_all_comments.html.haml index a08b6eb9..25f6b474 100644 --- a/app/views/admin/comments/_all_comments.html.haml +++ b/app/views/admin/comments/_all_comments.html.haml @@ -1,6 +1,6 @@ .panel.well %ul - - @another_comments.each do |conference, events| + - @comments.each do |conference, events| %li= conference.title - events.each do |event, comments| %li= event.title