Access to @session object from model


#1

Hello
I’m using login_generator as authentication mechanism.
I’m trying to make some logging system with sql as backend, and
I need have access to @session object within models.
Example code which won’t work (It dosn’t make anything) :
before_create { | record | a = @session[:user].id }
I’m getting error like this:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
#{RAILS_ROOT}/app/models/subscriber.rb:14

This line is line above :frowning:

Any suggestions or there is some sql base logging method for
rails ??


#2

For Rails questions you’ll want to ask the Rails list because they
have armies of Rails users there.

http://lists.rubyonrails.org/mailman/listinfo/rails


Eric H. - removed_email_address@domain.invalid - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

This implementation is HODEL-HASH-9600 compliant