what i need:
if :record is in the database -> upgrade his counter
else create :record (with his counter on 1)
this should be done with an atomic operation, to avoid race
conditions.
What is the best way to do this with activerecord?
I read about transactions, but as i understand a transaction acts on a
single connection to the database.
i think that multiple requests use multiple db connections, didn't
they? This is obviously true having two database server in a multi-
master configuration. I think that Frederick Cheung's solution should
solve the problem anyway.
thank you.