This question shows research effort; it is useful and clear
5
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
我想向我的 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>
*/
}