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 6337191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:12:21+00:00 2026-05-24T19:12:21+00:00

I am trying to figure out a way to log the changes when someone

  • 0

I am trying to figure out a way to log the changes when someone updates an object. Right now my observer will store all of the current values but I am lost on how to determine which fields changed and how to store them in my feeds db.

For sake of simplicity here is a sample model and observer. My goal is to track which field was updated and store it in my Feed db. I am open to adding new fields to my db if they are needed. Let me know if you have any questions.

Model

# Table name: milestones
#
#  id            :integer         not null, primary key
#  name          :string(255)
#  project_id    :integer
#  target_date   :datetime

Observer tracking the change

class MilestoneObserver < ActiveRecord::Observer

    def after_update(milestone)
        f = Feed.new(
          :action => milestone.name, 
          :project_id => milestone.project_id, 
          :updated_by_id => "Jordan")
        f.save
    end 
end
  • 1 1 Answer
  • 0 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. Editorial Team
    Editorial Team
    2026-05-24T19:12:22+00:00Added an answer on May 24, 2026 at 7:12 pm

    To know which fields have changed, do:

    object.changes
    

    See nice article here: http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects

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

Sidebar

Related Questions

I'm trying to figure out a way to serialize some Django model object to
I am trying to figure out a way to force all of my Interfaces
Hello I've been trying to figure out generic way to log http requests in
I'm trying to figure out a way to log off users in local Windows
I'm trying to figure out a way to add a self-update feature to a
I'm trying to figure out a way to detect files that are not opened
I'm trying to figure out a way to automatically cast something to an Action
I am trying to figure out a way to pre-process few things before my
I'm trying to figure out a way to use tar+pipes on a Ubuntu Server
I'm trying to figure out a way to find out which files were affected

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.