Sha256: 99c69c0e161a655020523effcf00dbf35dd17be112ef0eb2c6be74ec8f53a0ee

Contents?: true

Size: 502 Bytes

Versions: 1

Compression:

Stored size: 502 Bytes

Contents

module Storytime
  class PostTypePolicy
    attr_reader :user, :record

    def initialize(user, record)
      @user = user
      @post = record
    end

    def index?
      manage?
    end

    def create?
      manage?
    end

    def new?
      manage?
    end

    def update?
      manage?
    end

    def edit?
      manage?
    end

    def destroy?
      manage?
    end

    def manage?
      !@user.storytime_role.nil?
    end

    def permitted_attributes
      [:name]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storytime-0.0.2 app/policies/storytime/post_type_policy.rb