Sha256: a1de9aec428f642b6965c52b339b3cd19e8ee801589bb685c7e46a35b4ca2cfd
Contents?: true
Size: 754 Bytes
Versions: 58
Compression:
Stored size: 754 Bytes
Contents
module Spree class UserAddress < Spree::Base belongs_to :user, class_name: UserClassHandle.new, foreign_key: "user_id" belongs_to :address, class_name: "Spree::Address" validates_uniqueness_of :address_id, scope: :user_id validates_uniqueness_of :user_id, conditions: -> { active.default }, message: :default_address_exists, if: :default? scope :with_address_values, ->(address_attributes) do joins(:address).merge( Spree::Address.with_values(address_attributes) ) end scope :all_historical, -> { unscope(where: :archived) } scope :default, -> { where(default: true) } scope :active, -> { where(archived: false) } default_scope -> { order([default: :desc, updated_at: :desc]) } end end
Version data entries
58 entries across 58 versions & 1 rubygems