aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/customer_carrier.rb
blob: 3d236da43d35dadf0659f86c9ed5ca27f3a02bab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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