Skip to content

Commit 1a917bc

Browse files
zzetdzaporozhets
authored andcommitted
fix scope to empty relation
1 parent 2befa8f commit 1a917bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/user_team.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UserTeam < ActiveRecord::Base
1717

1818
scope :with_member, ->(user){ joins(:user_team_user_relationships).where(user_team_user_relationships: {user_id: user.id}) }
1919
scope :with_project, ->(project){ joins(:user_team_project_relationships).where(user_team_project_relationships: {project_id: project})}
20-
scope :without_project, ->(project){ where("id NOT IN (:ids)", ids: with_project(project))}
20+
scope :without_project, ->(project){ where("id NOT IN (:ids)", ids: (a = with_project(project); a.blank? ? 0 : a))}
2121
scope :created_by, ->(user){ where(owner_id: user) }
2222

2323
class << self

0 commit comments

Comments
 (0)