On Wednesday, November 20, 2013 4:19:40 PM UTC, Paulo Henrique Leite de 
Castro wrote:
>
> Hi Colin
>
> thanks for your reply!! I'll try it and see if I can find more info to 
> help me...
>
> I was also wondering where can I find how Rails (specially 2.3.x) deals 
> with sql result caching. This could help to diagnose a possible root cause.
>
>  
There is an sql cache in Rails, however it is scoped to the current request 
- you get a fresh cache for each request. When you say that you are setting 
the DB connection after authentication, what exactly are you doing (and by 
authentication do you mean when the user signs in or on every request once 
you have got a user_id from a session/cookie?) ?


Fred
 

> Best regards
>
> Em quarta-feira, 20 de novembro de 2013 05h34min08s UTC-2, Colin Law 
> escreveu:
>>
>> On 19 November 2013 19:55, Paulo Henrique Leite de Castro 
>> <[email protected]> wrote: 
>> > Hi 
>> > 
>> > I have this RoR (2.3.16) app that has a simple agenda tool. Each 
>> customer 
>> > has their own individual database, and I have one central database with 
>> > login, passwd and the customer database name. 
>> > Something like this: 
>> > 
>> > - main_database: 
>> >   - users_table: 
>> >     - login_field 
>> >     - passwd_field 
>> >     - database_name_field 
>> > 
>> > - customer_db_1: 
>> >  - tables .... 
>> > 
>> > - customer_db_2: 
>> >  - tables ... 
>> > 
>> > So, after user authentication, I set the correspondent database 
>> connection 
>> > according each customer. 
>> > 
>> > The problem is: 
>> > 
>> > Customer 1 sometimes see records from customer 2, even being on 
>> different 
>> > databases. 
>> > 
>> > I'm totally lost here... I just suspect that this could be a database 
>> > connection cache issue, since the SQL query is the same for every 
>> customer 
>> > (ie.: select * from agendas;) but the connection string is different 
>> for 
>> > each one. 
>> > 
>> > Most of the time everything runs ok.. but some customers are getting 
>> this 
>> > strange behaviour. 
>> > 
>> > Any idea of what could be happening? 
>>
>> Put some debug code in to log stuff in order that you can work out 
>> what it going wrong. 
>>
>> Colin 
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a7d57fa1-b28d-4bee-902c-852f71fed3d7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to