Sha256: 1d26e55258fc6bb35763358ea7bf81b3d06eef52964805330ab62d740d12ab54
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module Enjoy::Catalog module Models module Mongoid module Category extend ActiveSupport::Concern include Enjoy::HtmlField included do field :name, type: String, localize: Enjoy::Catalog.configuration.localize, default: "" acts_as_nested_set scope :sorted, -> { order_by([:lft, :asc]) } enjoy_cms_html_field :excerpt, type: String, localize: Enjoy::Catalog.configuration.localize, default: "" enjoy_cms_html_field :content, type: String, localize: Enjoy::Catalog.configuration.localize, default: "" if Enjoy::Catalog.config.gallery_support embeds_many :category_images, cascade_callbacks: true, class_name: "Enjoy::Catalog::CategoryImage" alias :images :category_images accepts_nested_attributes_for :category_images, allow_destroy: true end end def items item_class.in(category_ids: self.id) end def all_items item_class.any_in(category_ids: self.self_and_descendants.map(&:id)) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
enjoy_cms_catalog-0.4.1 | lib/enjoy/catalog/models/mongoid/category.rb |
enjoy_cms_catalog-0.4.0.6 | lib/enjoy/catalog/models/mongoid/category.rb |