Dynamically creating a query based on params being passed to a controller
In my task management application, users should be able to filter tasks based on : assignedTo , priority , status and/or dueDate I am not sure on how to create a dynamic query in that it will build a query based on the available parameters. For example : If I have a URL such as : task/index?assignedTo=1&status=2 I can build a query based on only these two parameters. The method I am used to is the Task.findAllByAssignedToAndStatus( User.get(params.assignedTo), TaskStatus.get(params.status) ) I obviously dont want to implement a DRY method by writing out each findAllBy query for every possible