Sha256: e49d73e5ec4267e2923acc0e17b7772e89f416a4da1e6ec5914f8e60c1f5edd1

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

module Gemgento

  # @author Gemgento LLC
  class Store < ActiveRecord::Base
    has_many :inventories
    has_many :orders
    has_many :product_imports
    has_many :product_categories
    has_many :product_attribute_options
    has_many :product_attribute_values
    has_many :users
    has_many :store_tags
    has_many :tags, through: :store_tags

    has_and_belongs_to_many :products, -> { distinct }, join_table: 'gemgento_stores_products', class_name: 'Product'
    has_and_belongs_to_many :categories, -> { distinct }, join_table: 'gemgento_categories_stores', class_name: 'Category'
    has_and_belongs_to_many :users, -> { distinct }, join_table: 'gemgento_stores_users', class_name: 'User'

    cattr_accessor :current

    def self.current
      @@current = Gemgento::Store.where.not(code: 'admin').first! if @@current.nil?
      return @@current
    end

    def self.current=(value)
      @@current = value
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/models/gemgento/store.rb