aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/customer_carrier.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/customer_carrier.rb')
-rw-r--r--activerecord/test/models/customer_carrier.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/models/customer_carrier.rb b/activerecord/test/models/customer_carrier.rb
new file mode 100644
index 0000000000..6cb9d5239d
--- /dev/null
+++ b/activerecord/test/models/customer_carrier.rb
@@ -0,0 +1,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