This is a good practice. I would recommend one addition though: only pull the columns from the DB that you need to fetch the right IDs, rather than everything. e.g.
Assuming shopper.can_order? is something like:
defcan_order?(p)country==p.countryend
then we only need to fetch two things: The ID (which we want to return), and the country which is used in can_order?.
This is a good practice. I would recommend one addition though: only pull the columns from the DB that you need to fetch the right IDs, rather than everything. e.g.
Assuming
shopper.can_order?is something like:then we only need to fetch two things: The ID (which we want to return), and the country which is used in can_order?.