class User

  def update_metadata
    self.update_attributes({:last_login_at => Time.now,
                            :last_known_up => request.remote_ip,
                            :last_known_user_agent =>
request.user_agent})
  end

This does not work. It bombs out with:

undefined local variable or method `request' for #<User:0x1e146e0>

But the request calls work in a controller such as:

@ip = request.remote_ip
@agent = request.user_agent

What is the proper way to get this data into my model?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to