Displaying 1 result from an estimated 1 matches for "last_known_user_ag".
2009 Feb 09
3
can't call request.remote_ip from object?
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 thi...