I have a table votes
and another table ratings
, when a user inserts a vote it should automatically increment the rating,
I am using postgresql triggers to do that, but I’m looking for a better way maybe using associations or another more efficient solution