Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

This version checks to make sure PHP didn’t run in to an error of some kind when executing the find action. How do you revise the Rfm example to handle the no-records-found problem?

0
Posted

This version checks to make sure PHP didn’t run in to an error of some kind when executing the find action. How do you revise the Rfm example to handle the no-records-found problem?

0

It already does. In Rfm, no records found isn’t an error. It just means you get an empty set of records back. Since Ruby is happy to loop through an empty array (it simply doesn’t enter the loop), your total will calculate without trouble. (If you want Rfm to raise an error when no records are found, you can tell it to. But usually you don’t want it to.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.