team.rb revision 7e3ffdd270e31d82db163acaf6d0849cb7dda0e8
# create admin user after team creation
}
validates :name, :uniqueness => { :case_sensitive => false }
def to_s
name
end
# does the given user have admin-privileges in this team?
def admin?(user)
user && (user.admin? || team_users.admin.find_by_user_id(user.id))
end
protected
# create admin user after team-creation
def create_admin_user
if admin_user
team_users.create! \
admin: true,
user: admin_user
end
end
end