Coder Social home page Coder Social logo

Comments (5)

bkeepers avatar bkeepers commented on May 18, 2024

@lesburg: I've run into this issue before too. It is because AR already has a #changes method defined, which show the changes to the current model since it was last saved. And due to the way that AR defines attribute accessors lazily, when you first call #changes, you're getting AR's version. But dumping the record causes it it define the attribute accessors.

To work around this, acts_as_audited should either explicitly define #changes, or rename it to something else that doesn't conflict.

from audited.

robg avatar robg commented on May 18, 2024

I'd vote for renaming to something other than #changes. Having an audit-specific #changes attribute causes problems with some of our change detection logic.

from audited.

 avatar commented on May 18, 2024

I'm find with doing that. I don't have time to work on it anytime soon, but if someone wanted to submit a patch, I'd be happy to pull it.

The patch should probably keep compatibility with the current version, and maybe deprecate the #changes method.

from audited.

kennethkalmer avatar kennethkalmer commented on May 18, 2024

As part of #30, the changes field has been renamed to audited_changes and should address this just fine. I'm closing this issue, please re-open if I've missed the plot completely.

from audited.

psahni avatar psahni commented on May 18, 2024

When I use object.attributes['changes'], the problem seems to be resolved for temporily

eg:-
a1 = Audit.first

a1.changes # {}
a1.attributes['changes'] # required changes hash say {:name => ['Prashant', 'Prashant Sahni']}

from audited.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.