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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:44:23+00:00 2026-05-14T07:44:23+00:00

I am writing a Ruby on Rails app and I want a method to

  • 0

I am writing a Ruby on Rails app and I want a method to be called every time the database is modified. Is it possible to do this without inserting a method call in every location where the database is modified?

  • 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-14T07:44:24+00:00Added an answer on May 14, 2026 at 7:44 am

    I like KandadaBooggu’s answer but if you did not want to monkey with AR you might be able to do this with an Observer.

    class AllObserver < ActiveRecord::Observer
      observe :model_a, :model_b
    
      def after_save(record)
        logger.info("CREATED #{record.class}")
      end
    
      def after_update(record)
        logger.info("UPDATED #{record.class}")
      end
    end
    

    Just add the models that you want to observer. In this example it will log updates to ModelA and ModelB

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

Sidebar

Related Questions

I'm writing an Ruby on Rails app using a legacy database. The problem I'm
When writing the create method for an object in a Ruby on Rails app,
I am writing a Ruby on Rails app. which will use a 3rd party
I'm writing a Ruby on Rails app that normally runs on Heroku or a
I'm writing a Ruby on Rails (3.1) app where a user can send emails
I am about to be writing a Ruby on Rails app which will use
I'm re-writing a Rails web app in C#. I'm really stuck with Ruby's hash
I’m writing an application with Ruby on Rails. This application will be delivered to
I'm writing a web form for my Ruby on Rails app. The form has
I am writing a facebook app by using ruby and rails. I will need

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.