Nicer fetch of empty relations

This commit is contained in:
Jan Renz
2015-04-28 14:20:21 +02:00
parent b8e35274ac
commit ea027656b7

View File

@ -39,7 +39,7 @@ class CommentsController < ApplicationController
#add names to comments #add names to comments
@comments.map{|comment| comment.username = Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]} @comments.map{|comment| comment.username = Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]}
else else
@comments = Comment.where(file_id: -1) #we need an empty relation here @comments = Comment.all.limit(0) #we need an empty relation here
end end
authorize! authorize!
end end