Topic: Access session variables from a plugin

Could anyone tell me how I can access session variables from a plugin that I am writing.  The way I want this to work is that when I call a method in the plugin I can specify an argument, but if I don't specify an argument, it gets the argument from the session hash.

Let's say I have a program that models a house, and plugin that has cleaning functions.  As I move around the house I keep track of my location as a session variable.  If I want to clean the room I'm in, I just have to run the command clean_room, but if I want to clean a different room, I specify the room id like clean_room(4).  I would envision the function to look something like this:

#this function is in a file in the plugin's 'lib' directory
def clean_room(room_id = session[:room])
  dust(room_id)
  sweep(room_id)
  mop(room_id)
end

Unfortunately "session" doesn't work.  Is there something I can mix into my plugin that will give me access to the session hash?

Re: Access session variables from a plugin

try request.session

ProgrammingBooks.org - Programming Books Ranked by Programmers
Turn of the Crank - My Personal Blog
Robot Walrus - My art prints & posters blog
My Game Ideas - Submit, rate, view video game Ideas

Re: Access session variables from a plugin

I tried that and was unable to get it to work, so I ended up changing my plugin to be included by ActionController and I was able to get it working.  I don't know if it's the perfect solution, but it is working.  Thanks.