You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
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
|
|
|