Sha256: b98a2886417b904474b31c6eb372690383cc62cc0d06749dedab248ab17e7313

Contents?: true

Size: 276 Bytes

Versions: 7

Compression:

Stored size: 276 Bytes

Contents

# 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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ibm_db-5.5.1 test/models/customer_carrier.rb
ibm_db-5.5.0 test/models/customer_carrier.rb
ibm_db-5.4.1 test/models/customer_carrier.rb
ibm_db-5.4.0 test/models/customer_carrier.rb
ibm_db-5.3.2 test/models/customer_carrier.rb
ibm_db-5.3.1 test/models/customer_carrier.rb
ruby-on-quails-0.1.0 activerecord/test/models/customer_carrier.rb