I am doing the following:
@group_coach = GroupCoach.find(“groups_count < ‘9’” )
I have a groups_count column in my db that is being updated by a counter_cache => true method in the Group model.
I know this isn’t right. Because the error it spits out: Couldn’t find GroupCoach with ID=groups_count < ‘9’
I have reviewed the Rails Guides:
client = Client.find(10)
Client.where(“orders_count = ‘2’”)
The second option does run in the localhost but isn’t actually returning a GroupCoach… It just returns groupcoach…
What is the proper syntax for this?
Have you tried:
To clarify:
@group_coachwill be a collection of records. So you can’t call@group_coach.namebecause all that will do is give you “GroupCoach” (the name of the class). Instead, you would need to iterate over the items: