I have a task model with a one to many relationship with a todo model.
If I do a find on the task model:
task = Tasks.find(1)
Is there a way to search the todos on a particular field without
hitting the database again. For example, If the todo model had a field
named label, could I do something like task.todos.find_by_label("…")
but not have it hit the database, because I already have all of the
todos within the task.
Is it best just to write a helper method that loops through the todos,
looking for the one with the correct label or is there something
already build into ruby to do this?
Thanks for your help!