Fix comment policy
This commit is contained in:
@@ -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?
|
||||
|
||||
|
Reference in New Issue
Block a user