No need for a workaround, you have Optimistic Locking (via lock_version field)
It raises an exception in case you try to update stale data.
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Opti...
It raises an exception in case you try to update stale data.
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Opti...
but in this specific case `affected_rows` works better as long as you know its reliable.
My solution is basically the same amount of lines, requires no such changes.