views:

46

answers:

2

Hello!

I have this Rails app that can be spawned (by Passenger) a number of times. I want to generate a random id for each instance and include it in every view (as a comment on the HTML output), and be able to access a specific instance using the id.

Is this possible with Passenger? Can I target a specific instance? I want to be able to run /reload, for example, on one of them.

Thanks for any help!

+2  A: 

One thing that might work, which is moderately random, is the process ID number. On most systems these will count up gradually over time, then repeat eventually. For example in ERB:

<!-- Passenger #<%= $$ %> -->

That way if you need to restart that particular process, you can just kill it from the command-line. For example, if it said "Passenger #12040":

% kill 12040
tadman
+1  A: 

With 2.2 you can't. However 3.0 will probably have such a feature. Watch our blog for news.

Hongli