コントローラーに次のメソッドがあり、Patient エンティティを一覧表示するために使用されます。
def list(Integer max) {
params.max = Math.min(max ?: 10, 100)
def roles = springSecurityService.getPrincipal().getAuthorities()
if(roles == 'ROLE_USER')
{
[patientInstanceList: Patient.findAllBySecUser(springSecurityService.getCurrentUser()), patientInstanceTotal: Patient.count()]
}
else if(roles == 'ROLE_ADMIN' || roles == 'ROLE_MANAGER')
{
[patientInstanceList: Patient.list(params), patientInstanceTotal: Patient.count()]
}
}
この方法を実行すると、例外があります
Tag [paginate] is missing required attribute [total]
しかし、私が以下を使用する場合
def list(Integer max) {
params.max = Math.min(max ?: 10, 100)
[patientInstanceList: Patient.list(params), patientInstanceTotal: Patient.count()]
}
}
すべてがうまく機能します。作成された患者のすべてのインスタンスが表示されます。ログインしたユーザーの役割に基づいて、作成されたすべてのエンティティの一部を表示できることだけが必要です。この例外が発生するのはなぜですか?
私はここでGrails pagination tag errorに似たものを見つけましたが、良い答えはありませんでした