From 41e1aaa00fa5799b6893e0786e972b15533e1401 Mon Sep 17 00:00:00 2001 From: Alessandro Desantis Date: Fri, 9 Oct 2020 09:58:54 +0200 Subject: Fix DefaultCustomer permission set with CanCan 2 CanCan 2 complains about not being able to merge abilities that use an ActiveRecord scope, so we need to use an SQL string instead. --- lib/solidus_subscriptions/permission_sets/default_customer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/solidus_subscriptions/permission_sets') diff --git a/lib/solidus_subscriptions/permission_sets/default_customer.rb b/lib/solidus_subscriptions/permission_sets/default_customer.rb index 156a5e1..df9845e 100644 --- a/lib/solidus_subscriptions/permission_sets/default_customer.rb +++ b/lib/solidus_subscriptions/permission_sets/default_customer.rb @@ -4,7 +4,7 @@ module SolidusSubscriptions module PermissionSets class DefaultCustomer < ::Spree::PermissionSets::Base def activate! - can :manage, Subscription, Subscription.where(user: user) do |subscription, guest_token| + can :manage, Subscription, ['user_id = ?', user.id] do |subscription, guest_token| (subscription.guest_token.present? && subscription.guest_token == guest_token) || (subscription.user && subscription.user == user) end -- cgit v1.2.3