diff options
Diffstat (limited to 'activerecord/test/models/customer_carrier.rb')
-rw-r--r-- | activerecord/test/models/customer_carrier.rb | 14 |
1 files changed, 14 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..37186903ff --- /dev/null +++ b/activerecord/test/models/customer_carrier.rb @@ -0,0 +1,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 |