Added UserTeam core models (team and m-t-m relationships) and updated other models

This commit is contained in:
Andrey Kumanyaev 2013-01-19 21:06:50 +04:00 committed by Dmitriy Zaporozhets
parent f6c482c06f
commit 8a86fe7bb0
14 changed files with 248 additions and 28 deletions

View 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