There should be a note for the otp_counter migration to set default:0 and null:false.
Since if otp_counter is equal to nil and you try to fetch the otp_code in the following code:
def otp_code(options = {})
if otp_counter_based
if options[:auto_increment]
self.otp_counter += 1
save if !new_record?
end
...
An error will occur because you cannot add 1 to nil. self.otp_counter += 1
There should be a note for the otp_counter migration to set default:0 and null:false. Since if otp_counter is equal to nil and you try to fetch the
otp_code
in the following code:An error will occur because you cannot add 1 to nil.
self.otp_counter += 1