aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/membership.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/membership.rb')
-rw-r--r--activerecord/test/models/membership.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/models/membership.rb b/activerecord/test/models/membership.rb
index df7167ee93..e181ba1f11 100644
--- a/activerecord/test/models/membership.rb
+++ b/activerecord/test/models/membership.rb
@@ -18,3 +18,18 @@ class SelectedMembership < Membership
select("'1' as foo")
end
end
+
+class TenantMembership < Membership
+ cattr_accessor :current_member
+
+ belongs_to :member
+ belongs_to :club
+
+ default_scope -> {
+ if current_member
+ where(member: current_member)
+ else
+ all
+ end
+ }
+end