don't update failed_attempts attribute if already equal to 0
record is potentially unchanged here, if so, no needs to save it
Merge pull request #2444 from julp/no_ghost_transactions

Fix empty transactions created by devise