Forum: Ruby Access to @session object from model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
mj-usunto (Guest)
on 2005-11-22 14:44
(Received via mailing list)
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 ??
drbrain (Guest)
on 2005-11-22 21:27
(Received via mailing list)
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
This topic is locked and can not be replied to.