Sha256: 96aaaeeb5ad5defc513f67fa3d4794f228eb5aa40cd7035cffca15f9f35cee4b

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

module Enjoy::Catalog
  module Models
    module Mongoid
      module Item
        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: ""

          has_and_belongs_to_many :categories, class_name: "Enjoy::Catalog::Category", inverse_of: nil

          embeds_many :item_images, cascade_callbacks: true, class_name: "Enjoy::Catalog::ItemImage"
          alias :images :item_images
          accepts_nested_attributes_for :item_images, allow_destroy: true

          has_and_belongs_to_many :related_items, :class_name => "Enjoy::Catalog::Item", :inverse_of => :related_items

          # money_field :price, default_currency: nil
          field :price,     type: Money,    default: nil, localize: Enjoy::Catalog.configuration.localize
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enjoy_cms_catalog-0.4.0.5 lib/enjoy/catalog/models/mongoid/item.rb
enjoy_cms_catalog-0.4.0.4 lib/enjoy/catalog/models/mongoid/item.rb
enjoy_cms_catalog-0.4.0.3 lib/enjoy/catalog/models/mongoid/item.rb
enjoy_cms_catalog-0.4.0.2 lib/enjoy/catalog/models/mongoid/item.rb
enjoy_cms_catalog-0.4.0.1 lib/enjoy/catalog/models/mongoid/item.rb
enjoy_cms_catalog-0.4.0 lib/enjoy/catalog/models/mongoid/item.rb