aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/customer_carrier.rb
blob: 6cb9d5239d4c86e9e3aaae76c23f0a5c1103a576 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class CustomerCarrier < ActiveRecord::Base
  cattr_accessor :current_customer

  belongs_to :customer
  belongs_to :carrier

  default_scope -> {
    if current_customer
      where(customer: current_customer)
    else
      all
    end
  }
end