Sha256: f4717ef051cb226ccdcf08ce26ca7443eabb58015eb9dcca85d2b772055a2c2c

Contents?: true

Size: 375 Bytes

Versions: 9

Compression:

Stored size: 375 Bytes

Contents

class ShelfPolicy < ApplicationPolicy
  def index?
    true
  end

  def show?
    true
  end

  def create?
    true if user.try(:has_role?, 'Administrator')
  end

  def update?
    true if user.try(:has_role?, 'Administrator')
  end

  def destroy?
    if user.try(:has_role?, 'Administrator')
      true if record.items.count == 0 && !record.web_shelf?
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_library-0.3.11 app/policies/shelf_policy.rb
enju_library-0.3.10 app/policies/shelf_policy.rb
enju_library-0.3.9 app/policies/shelf_policy.rb
enju_library-0.3.8 app/policies/shelf_policy.rb
enju_library-0.3.8.rc.2 app/policies/shelf_policy.rb
enju_library-0.3.8.rc.1 app/policies/shelf_policy.rb
enju_library-0.4.0.rc.1 app/policies/shelf_policy.rb
enju_library-0.3.7 app/policies/shelf_policy.rb
enju_library-0.3.6 app/policies/shelf_policy.rb