I have an existing app that has many, many models. I'd like to log the IP address of the user that created them with the primary purpose being a way to help weed out spammers or other abusive users (if I don't know what IP address(es) they are using, I can't block it). I would need to keep track of these over time as users may access from home, the office, their phone, etc. and I'd want to see usage patterns. It also might be kind of fun to map out where users are visiting from or something, but any side-effects are purely thought-stuff at this time.
We use the cookie-based method of storing user sessions.
I can think of two ways of doing this (I'll create them as replies so people can vote):
- Add IP address attribute to every model, and pass that in
- Some sort of Logger model that is called with an observer or after_save callback
Thoughts? Are there better ways? Plugins that do this? Thanks!!