can't call request.remote_ip from object?

Models should be blissfully unaware that they are attached to a web
app. For example, if you use your models from the console, or a rake
task, there is no web app, so if your models assume that a controller
exists you're asking for trouble.

In this case, however, you can simply feed the :last_known_up
and :last_known_user_agent to your model this way:

class UserController
  def some_action
    @user = User.find(params[:id])
    @user.update_metadata(:last_known_up =>
request.remote_ip, :last_known_user_agent => request.user_agent)
  end
end

class User
  def update_metadata(options = {})
    options.reverse_merge!(:last_login_at => Time.now)
    self.update_attributes(options)
  end
end

Brent