AyuntamientoMadrid/participacion

View on GitHub
app/components/shared/moderation_actions_component.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Shared::ModerationActionsComponent < ApplicationComponent
  attr_reader :record
  use_helpers :can?

  def initialize(record)
    @record = record
  end

  def render?
    can?(:hide, record) || can?(:hide, author)
  end

  private

    def author
      record.author
    end

    def hide_path
      polymorphic_path([:moderation, record], action: :hide)
    end
end