Given a decimal column, is there a nice way to query for approximate equality?
You can use ranges:
Purchase.where(total: (value - delta)..(value + delta)).first
But it looks like a common enough issue that Rails would usually try to solve for you, given that floating numbers can't always be represented exactly.