Ruby on Rails Thursday, December 31, 2015

'krfg' via Ruby on Rails: Talk <rubyonrails-talk@googlegroups.com> writes:

> On Tuesday, December 29, 2015 at 7:31:36 PM UTC+1, tamouse wrote:
>>
>>
>> >> What happened when you tried creating a new test application?
>> >>
>>
>> The problem as you've stated it is that your first user gets id=2. The
>> point of the test is to find the minimum set of conditions that
>> reproduce that behaviour so you can see why it's happening...
>
> ... Then prepare the app for heroku, create a new app at heroku for
>> this test app, and run it on heroku and see what happens
>
>
> I just finished to create a new test app as you suggested.
> In the test app too first user created got id 2 instead of 1, and there is
> no user with id 1.
> I am really puzzled...
>
> I recreated the same conditions of the former application, following the
> same steps.
> However I did not repeated the error of duplicating the User model and of
> migrating the migration in any topic branch. This means that what is
> creating the issue is something else.
>
> I used a new, totally separated public workspace at Colud9.
>
> I tried to figure out what can causing the issue and found just 2 possible
> explanations:
>
> 1. I added a new user in my development environment at Cloud9 and deployed
> at Heroku without resetting the database at Cloud9
> 2. I added a new user at Heroku with the console in sandbox mode.

This is it, exactly. Sandbox mode inserts the record, but since it's
running in a transaction, the table is then truncated. Table truncation
in Postgres does not reset the id sequence without a specific directive
to do so.

> Point 2 could explain what Colin Law previously suggested, that is that id
> numbers are not reused: is it possible that this rule is effective even
> when the user is created with the console in a sandbox mode?



--
Tamara Temple
tamouse@gmail.com
http://www.tamouse.org

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/m237uig7hi.fsf%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment