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

> On Sunday, December 27, 2015 at 7:17:17 PM UTC+1, Hassan Schroeder wrote:
>>
>>
>> I can't imagine that being a possibility, but what's stopping you from
>> looking for yourself?
>>
>> And if you're concerned that an action is causing duplicate queries
>> to be run, why not look at the DB logs?
>>
>
> I am a beginner, have a only two months study experience, so I would not
> know how to do it, honestly. Sorry for that!

The way you do it is to create a very small test rails application with
a single model, create an heroku app for it, and see what happens to the
when you create the first model record. Isolating everything out of the
mix that may have been happining with your other app, previous attempts
to use the data base, etc. If you can recreate that problem in a new
app, (which I cannot; my tests show it working as expected), then
carefully writing down exactly what happened and posting the code so we
can try it ourselves, we might have something.

> Basically, I would like to check whether my suspicion is correct or not,
> and in case it is correct find a solution: I would appreciate any hint on
> how to do it.

Personally, I have the suspicion that you've used the same database on
that Heroku project for a previous try with this app and it's an
artifact of having previously created a user in that table in the
database. To be perfectly sure, you can drop and recreate the database
on heroku with this command:

    heroku run rake db:drop db:create db:migrate

and when that's complete, create your first user again and see what
happens.

If that actually shows that the id's start from one (which my tests do
show), then you have your answer. If not, then try the test application
route, documenting each step fully.

> In case everything is fine, I would feel surely relieved, but I would like
> to know anyway the reason of this repetition, unless someone of you
> reassured me that it is a normal behaviour due to some reason, for instance
> because PostgreSQL queries produces double responses like those or else...

This actually is normal, though confusing, but the reason is much
simpler: when you're running the console at heroku, *both* irb *and* the
heroku logger are writing to output, so you get two messages, one from
irb and one from the logger. There is only one actual database operation
happening.

--
Tamara Temple
tamo...@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+unsubscr...@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/m2poxrqlcz.fsf%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to