I have a Model
I need to get the next record id which is going to be create before create that object in my model like:
MyModel.last.id #=> 10
MyModel.last.destroy
MyModel.last.id #=> 9, so (Model.last.id + 1) would be 10... but...
MyModel.create #=> 11, my next id was actually 11
Can you please suggest a better way to solve my problem?
Thanks
Aucun commentaire:
Enregistrer un commentaire