TypeError => Symbol as array index

Hello,

I’ve got a controller, which I’d like to protect from being accessed by
untrusted users. I saw that you can use before_filter to do it.
I tried before_filter :filter on the page I’d like to protect and then
creating a private method on the super class and it works. I’d now like
to get some information from the controller … So I tried before_filter
ApplicationController on the controller and then :

def self.filter(controller)
id = self.session[:user_id]
# some other stuff
end

And now, I get an error at the line of session :

TypeError in AdministrationController#index
Symbol as array index

Could you explain me why ?

Thanks a lot

Hello,

I found my own answer : the method is statical (because of self) and
session cannot be accessed from a statical context