Skip to content
Snippets Groups Projects
Commit 7a90003d authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

fix delete learning objects from collections

parent 6abc3870
No related branches found
No related tags found
No related merge requests found
...@@ -209,8 +209,12 @@ class CollectionsController < ApplicationController ...@@ -209,8 +209,12 @@ class CollectionsController < ApplicationController
end end
def authorize_action def authorize_action
@collection ||= Collection.new if !@collections.nil?
authorize @collection @collections.each { |c| authorize c }
else
@collection ||= Collection.new
authorize @collection
end
end end
end end
...@@ -3,8 +3,6 @@ class CollectionPolicy < ApplicationPolicy ...@@ -3,8 +3,6 @@ class CollectionPolicy < ApplicationPolicy
include FollowablePolicy include FollowablePolicy
class Scope < Scope class Scope < Scope
def initialize (user, user_id, scope) def initialize (user, user_id, scope)
@user = user @user = user
@user_id = user_id @user_id = user_id
...@@ -12,7 +10,6 @@ class CollectionPolicy < ApplicationPolicy ...@@ -12,7 +10,6 @@ class CollectionPolicy < ApplicationPolicy
end end
def resolve def resolve
if @user.try(:id) == @user_id || @user.try(:is_admin?) if @user.try(:id) == @user_id || @user.try(:is_admin?)
scope.all scope.all
else else
...@@ -21,7 +18,6 @@ class CollectionPolicy < ApplicationPolicy ...@@ -21,7 +18,6 @@ class CollectionPolicy < ApplicationPolicy
end end
end end
def create? def create?
record if user_exists? record if user_exists?
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment