infusionvlc/ConexionFelina

View on GitHub
app/policies/illness_policy.rb

Summary

Maintainability
A
0 mins
Test Coverage
class IllnessPolicy < ApplicationPolicy
  attr_reader :user, :illness

  def initialize(user, illness)
    @user = user
    @illness = illness
  end

  def new?
    !@user.nil? && (@user.role == 'volunteer' || @user.role == 'admin')
  end

  def create?
    new?
  end
  
  def edit?
    new?
  end

  def update?
    new?
  end

  def destroy?
    new?
  end

  def show?
    !@user.nil? && (@user.role == "volunteer" || @user.role == "admin")
  end
end