James Allman
James Allman

Reputation: 41158

Grails where query criteria qualification

Is there a way to qualify method parameters versus domain properties in a Grails where query criteria when they are named identically?

For example:

def getPeople(age, sex) {
    People.find { age == age && sex == sex }
}

Upvotes: 3

Views: 234

Answers (1)

Fabiano Taioli
Fabiano Taioli

Reputation: 5540

Something like this!?

def getPeople(age, sex) {
    People.find { delegate.age == age && delegate.sex == sex }
}

Upvotes: 1

Related Questions