class BaseComponent < ViewComponent::Base attr_reader :ability, :current_user def initialize(current_user:) @current_user = current_user @ability = Ability.new(current_user) end def can?(action, klass) return if action.blank? || klass.blank? ability.can?(action, klass) end end