Added UserTeam core models (team and m-t-m relationships) and updated other models
This commit is contained in:
parent
f6c482c06f
commit
8a86fe7bb0
14 changed files with 248 additions and 28 deletions
15
app/models/user_team_user_relationship.rb
Normal file
15
app/models/user_team_user_relationship.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class UserTeamUserRelationship < ActiveRecord::Base
|
||||
attr_accessible :group_admin, :permission, :user_id, :user_team_id
|
||||
|
||||
belongs_to :user_team
|
||||
belongs_to :user
|
||||
|
||||
validates :user_team, presence: true
|
||||
validates :user, presence: true
|
||||
|
||||
scope :with_user, ->(user) { where(user_id: user.id) }
|
||||
|
||||
def user_name
|
||||
user.name
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue