Sha256: 94d8b6adb0601f59ffc3c57f26bd7352aaf640a0a2356c5d297538bd82bd1f0f

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

module AckRocketCmsCatalog
  module Models
    module ItemCategory
      extend ActiveSupport::Concern
      include RocketCMS::Model
      include AckRocketCmsCatalog.orm_specific('ItemCategory')

      include Enableable
      include Seoable
      include SitemapData

      include ManualSlug

      included do
        manual_slug :name

        def clean_excerpt
          Rails::Html::FullSanitizer.new.sanitize(self.excerpt.strip)
        end

        def clean_content
          Rails::Html::FullSanitizer.new.sanitize(self.content.strip)
        end

        def items
          AckRocketCmsCatalog::Item.in(item_category_ids: self.id)
        end

        def all_items
          AckRocketCmsCatalog::Item.any_in(item_category_ids: self.self_and_descendants.map(&:id))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ack_rocket_cms_catalog-0.2.0 lib/ack_rocket_cms_catalog/models/item_category.rb