views:

20

answers:

0

I'm wondering if there's a more direct way to get and record a users IP in the model itself. I've been doing it from the controller but I noticed using the rakismet gem it mentions doing everything from within the model, but not the IP specifically.

http://github.com/joshfrench/rakismet

Currently I'm doing this, just before I save from the controller. It works fine.

@notification = Notification.new(params[:notification].merge(:user_ip => request.remote_ip, :user_agent => request.user_agent, :referrer => request.referrer))