mercredi 25 mars 2015

Rails: Accessing session in Initializer

I am interested in logging the time taken by my GETs and POSTs(split by time spent in Views, ActiveRecords etc.,).


Following this blog, I created a initializers/timing.rb and subscribed to notifications as below ActiveSupport::Notifications.subscribe /process_action.action_controller/


I am able to see the timing information of my every GET and POST.


Additionally I have some info in the session(we use redis), that I intend to log along with this timing log, in my initializer


Two questions



  1. How do I access session object in initializers/timing.rb? I did a lot of googling around, but could not find an answer that really worked.

  2. Are the variables I declare and use in timing.rb thread safe, in the event of my web server serving multiple http requests simultaneously?

  3. Is it compulsory that I have to use Modules?


My softwares Rails 3.2.13


FYI Answers in this link did not help


Aucun commentaire:

Enregistrer un commentaire