Forum: Ruby on Rails Retrieve session_key

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
391f7ae8dd8c10dc323b7fbfe55b71a2?d=identicon&s=25 monki (Guest)
on 2007-03-13 06:31
(Received via mailing list)
The unobtrusive javascript plugin stores its generate javascript files
in the session.
But it has some issues currently putting things into the wrong session
(because it doesn't check to see what session key is being set in the
application controller).  As such, it doesn't work unless you
explicitly set the session key.

Currently I just added a line to my application controller like so:
UnobtrusiveJavascriptController.send :session, :session_key =>

I'd like to fix the UJS plugin and submit a patch, but I'm not sure
how to best go about it.

You can't simply change the UnobtrusiveJavascriptController to derive
from ApplicationController because it won't know what it is when it
loads.  So possibly you could do this, but specify a dependency or
order of loading?

Otherwise within the UJS controller you could set the session key to
match the application.  The only way I have been able to get this to
work is the following:
session :session_key =>

But this seems fragile and inelegant to say the least.

Comments, suggestions?
This topic is locked and can not be replied to.