metamaps--metamaps/app/policies/attachment_policy.rb

22 lines
379 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-02-06 05:43:10 +00:00
class AttachmentPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.where(attachable: TopicPolicy::Scope.new(user, Topic).resolve)
end
end
def index?
true
end
def create?
Pundit.policy(user, record.attachable).update?
end
def destroy?
Pundit.policy(user, record.attachable).update?
end
end