dimanche 28 octobre 2018

Thread.current keeps changing.

I'm running a rails instance using rails s in my local development branch. I'm trying to store a variable in my current thread .

 Thread.current[:group_id] = 2 

When i go to a different route in my same app, the key group_id is not present. When i checked with a debugger, the Thread.current was different than the previous one.

 1. #<Thread:0x007fa4dcbd17c0 run> 

 2. #<Thread:0x007fa4dbd1efe8 run> 

Can someone help me with this?

Aucun commentaire:

Enregistrer un commentaire