aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/models/customer_carrier.rb
blob: 37186903ffc76d0767ceb9149e80a3226fe7f484 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                          
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