bugfixes, policies, errors now have a link to the submissions
This commit is contained in:
22
app/policies/comment_policy.rb
Normal file
22
app/policies/comment_policy.rb
Normal file
@ -0,0 +1,22 @@
|
||||
class CommentPolicy < ApplicationPolicy
|
||||
def author?
|
||||
@user == @record.author
|
||||
end
|
||||
private :author?
|
||||
|
||||
def create?
|
||||
everyone
|
||||
end
|
||||
|
||||
[:new?, :show?, :destroy?].each do |action|
|
||||
define_method(action) { admin? || author? }
|
||||
end
|
||||
|
||||
def edit?
|
||||
admin?
|
||||
end
|
||||
|
||||
def index?
|
||||
everyone
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user