From 5af73808048a03a3a5e54f08bad1aeb1c74156cf Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sun, 22 May 2016 09:32:59 +0700 Subject: Fix Member spec --- app/models/members/project_member.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index fa04963a1b7..5c167db76b1 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -14,7 +14,7 @@ class ProjectMember < Member scope :in_projects, ->(projects) { where(source_id: projects.pluck(:id)) } scope :with_user, ->(user) { where(user_id: user.id) } - before_destroy { user.todos.where(project_id: source_id).each(&:destroy) } + before_destroy { user.todos.where(project_id: source_id).each(&:destroy) if user } class << self -- cgit v1.2.1