diff options
author | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-10-09 09:58:54 +0200 |
---|---|---|
committer | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-10-09 09:58:54 +0200 |
commit | 41e1aaa00fa5799b6893e0786e972b15533e1401 (patch) | |
tree | 41d75343a418f2ebc92ead18a47f4e60804d944a /lib/solidus_subscriptions | |
parent | 811e7df206c304987b3ce4984ea6840f1fa78440 (diff) |
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.
Diffstat (limited to 'lib/solidus_subscriptions')
-rw-r--r-- | lib/solidus_subscriptions/permission_sets/default_customer.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |