Sha256: 5e81130f67c445364045c3a1038759ac10a66372a8610e57d3a46c305c16e243

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

class Product
  include Mongoid::Document
  include Mongoid::Search
  include Mongoid::Attributes::Dynamic if ::Mongoid::VERSION >= '4'

  field :brand
  field :name
  field :attrs, type: Array
  field :info, type: Hash

  has_many :tags
  if Mongoid::Compatibility::Version.mongoid6_or_newer?
    belongs_to  :category, required: false
  else
    belongs_to  :category
  end
  embeds_many :subproducts

  search_in :brand, :name, :outlet, :attrs, tags: :name, category: %i[name description],
                                            subproducts: %i[brand name], info: %i[summary description]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_search-0.3.5 spec/models/product.rb