Sha256: e5ea34ad1fc018ad9dd98be54f846f1dd38bbb886eaa2a73f6cf562c2a823fc6

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

class Choice
  include Mongoid::Document
  attr_accessible :adjusted_price, :stock, :values

  embedded_in :option

  field :_id, type: String, default: nil
  field :adjusted_price, type: Float
  field :values, type: Array
  field :in_stock, type: Boolean
end


class Option
  include Mongoid::Document
  embedded_in :product

  field :_id, type: String, default: nil
  embeds_many :choices
  field :template, type: Array
  field :name, type: String

end


class Product
  include Mongoid::Document
  include Mongoid::Timestamps

  default_scope ne(status: "DELETED").limit(20)
  scope :filter_store, ->(store_id) {where(store_id: store_id)}

  belongs_to :category, index: true
  belongs_to :store, index: true
  embedded_in :widget

  embeds_one :cover, as: :photoable, class_name: 'Photo', store_as: 'cover'
  embeds_many :photos
  embeds_one :activity
  embeds_one :option
  embeds_one :price, as: :pricable
  embeds_one :retail_price, as: :pricable, class_name: 'Price', store_as: 'retail_price'

  embeds_one :settings, class_name: "Settings"

  field :fb_id, type: String
  field :lid, type: Integer
  field :category_lid  , type: Integer


  field :status, type: String
  field :name, type: String
  field :description, type: String
  field :content, type: String #<html>



  field :in_stock, type: Boolean
  field :position, type: Float

  field :sku, type: String
  field :keywords, type: Array
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
models-0.0.22.1 app/models/product.rb