Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 120551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:49:45+00:00 2026-05-11T03:49:45+00:00

I have an existing app that has many, many models. I’d like to log

  • 0

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):

  1. Add IP address attribute to every model, and pass that in
  2. 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!!

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:49:46+00:00Added an answer on May 11, 2026 at 3:49 am

    I would use a polymorphic association for this, and then you can apply it to all your models that need to be tracked. That keeps the messyness of adding an IP address column to every model to a minimum and will dramatically cut down on the amount of duplication across your codebase. Then going the observer route is probably the easiest way to hook up to your models.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing web app that has a data layer and a bll
I have a rails app which currently has 3 models: Post , User and
I have an existing Django project that has several models using concrete inheritance of
We have an existing winforms app that (connects to a .NET Remoting Service)has a
I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code
I have implemented an iPhone App that has FanWall in it where users are
I have an existing data format that has portions of it encrypted in what
I have an app in progress that has a lot of views for various
I have an iPad app that has draggable UIViews contained in a larger parent
I have an app that currently has this line: [myView setWantsLayer:YES]; In order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.