AyuntamientoMadrid/participacion

View on GitHub
app/components/budgets/investments/content_blocks_component.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Budgets::Investments::ContentBlocksComponent < ApplicationComponent
  attr_reader :heading

  def initialize(heading)
    @heading = heading
  end

  def render?
    heading&.allow_custom_content && content_blocks.any?
  end

  private

    def content_blocks
      heading.content_blocks.where(locale: I18n.locale)
    end
end