summaryrefslogtreecommitdiff
path: root/app/models/members
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-14 20:38:57 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-14 20:38:57 +0300
commit13af7de9411ef20fcab00f7c5d7cdc6b90dbd4b7 (patch)
tree31876b6aa09c0c838ec3838aa0072293b3a0f0e6 /app/models/members
parent8210d813812571b479d630ff61410347f8ebeb5b (diff)
downloadgitlab-ce-13af7de9411ef20fcab00f7c5d7cdc6b90dbd4b7.tar.gz
Fix migration and association for new members table
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/members')
-rw-r--r--app/models/members/group_member.rb2
-rw-r--r--app/models/members/project_member.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb
index 7f68662de70..e7eb4a18e34 100644
--- a/app/models/members/group_member.rb
+++ b/app/models/members/group_member.rb
@@ -1,6 +1,8 @@
class GroupMember < Member
SOURCE_TYPE = 'Group'
+ belongs_to :group, class_name: 'Group', foreign_key: 'source_id'
+
# Make sure group member points only to group as it source
default_value_for :source_type, SOURCE_TYPE
validates_format_of :source_type, with: /\AGroup\z/
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb
index 403b87b7e36..3f8137ed06e 100644
--- a/app/models/members/project_member.rb
+++ b/app/models/members/project_member.rb
@@ -3,6 +3,8 @@ class ProjectMember < Member
include Gitlab::ShellAdapter
+ belongs_to :project, class_name: 'Project', foreign_key: 'source_id'
+
# Make sure project member points only to project as it source
default_value_for :source_type, SOURCE_TYPE
validates_format_of :source_type, with: /\AProject\z/