>
> > > Makund - it is quite likely that your solution will break when
> > > multithreading arrives (as will will loads of other stuff)
>

You could try using Thread.current in your model when storing your
class variable.

For example, in your User model, you could have the following methods:

def self.ip_address=(ip_address)
    Thread.current[:ip_address] = ip_address
end

def self.ip_address
    Thread.current[:ip_address]
end

You would set these as part of your authentication process

User.ip_address = request.remote_ip

Then you might be able to use this in a :before_save filter in your
models

before_save :set_ip_address

def set_ip_address
  self.ip_address = User.ip_address
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to