Sha256: e4d051f83e29c85d4aa3ce4b4e9f955ff6b7304abc3c092c32f85db8b1d66214

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

class Spree::Base < ActiveRecord::Base
  include Spree::Preferences::Preferable
  include Spree::Core::Permalinks
  include Spree::RansackableAttributes

  def initialize_preference_defaults
    if has_attribute?(:preferences)
      self.preferences = default_preferences.merge(preferences)
    end
  end

  # Only run preference initialization on models which requires it. Improves
  # performance of record initialization slightly.
  def self.preference(*args)
    # after_initialize can be called multiple times with the same symbol, it
    # will only be called once on initialization.
    serialize :preferences, Hash
    after_initialize :initialize_preference_defaults
    super
  end

  self.abstract_class = true

  # Provides a scope that should be included any time products
  # are fetched with the intention of displaying to the user.
  #
  # Allows individual stores to include any active record scopes or joins
  # when products are displayed.
  def self.display_includes
    where(nil)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_core-3.0.0.rc2 app/models/spree/base.rb