When you have a column calculated in Postgres, you need to call reload for the values to fetched from the DB.
I think it would be great if rails models could accept a list of parameters that shuold be returned after a DB operation using postgres RETURNING feature, just like it is happening with the record id.
I have opened a PR implementing this feature for create operation. The test suite is in red for now but the relevant test is passing locally.
Adding this feature has been discussed in this GH issue, but I’m posting it here per @matthewd 's suggestion. Please let me know if you guys think this feature will be accepted and I will continue working in the PR.