题
我想在我的User模型中添加一个属性,该属性返回Project表中具有该用户的用户ID的行数。
所以这样......
def numProjects = {
/* somehow get count from Project table
The straight sql would be:
SELECT COUNT(*) FROM projects WHERE userId = <the current user>
*/
}
不隶属于 StackOverflow