Я думаю, вы должны инициализировать массив
@preComments = Comment.where(:resource_hash => resource_hash).sort(:created_at.desc).all
@comments = []
@preComments.each do |comment|
u = ::User.find_by_id comment.user_id
p u
@comments << comment
p "HERE!!!!!"
end
или когда цикл завершится, передайте значения @preComments в @ comments
@preComments = Comment.where(:resource_hash => resource_hash).sort(:created_at.desc).all
@preComments.each do |comment|
u = ::User.find_by_id comment.user_id
p u
p "HERE!!!!!"
end
@comments = @preComments