Fix comment policy

This commit is contained in:
Maximilian Grundke
2016-04-26 17:42:53 +02:00
parent 4b5cd5a22a
commit 57b773698b
3 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,12 @@
class CommentPolicy < ApplicationPolicy
def author?
@user == @record.author
if @record.is_a?(ActiveRecord::Relation)
flag = true
@record.all {|item| flag = (flag and item.author == @user)}
flag
else
@user == @record.author
end
end
private :author?