[rails] Access to @session object from model

M

Marcin Jurczuk

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 :(

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top