This is kind of a long post so I apologize in advance.
While following the Rails tutorial, I ran across an issue when creating users in rails console. Just for testing purposes I have created two users through rails console. Respectively, each has a column 'id'. I noticed that once I ran the 'rails test:models' command in another terminal window, my tests would either fail or pass, and I would then jump back into the rails console to check the Users and I would end up with two objects that no longer had the name and email I assigned them. Instead the name and email fields were filled with 'MyString' and had a incredibly large out of sequence id like '298486374' and '980190962' instead of 1 and 2 in the id column.
I have resorted to using the gem "reset_pk_sequence" to reset the id column back to '1' after using the 'delete_all' command and have since been able to recreate the issue multiple times.
Below is a link to a video I made to show what I am going through.
Can anyone explain this phenomenon and how I could possibly fix it?
Aucun commentaire:
Enregistrer un commentaire