mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 20:54:03 +00:00
rewrite CommentsController#index to have everything in one call
This commit is contained in:
parent
449d466f7d
commit
b762b82e74
2 changed files with 2 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue