Git Product home page Git Product logo

Comments (7)

bdiz avatar bdiz commented on August 25, 2024 1

@kennethkalmer, would you like us to take a stab at this? We would really like the ability to change the name of the :version attr_accessor on our models to get rid of our monkey patches. Let us know if you'd have time to accept our PR before we spend time on it. Thanks.

from audited.

amattsmith avatar amattsmith commented on August 25, 2024

Curious as to what your workaround was? I am running into the same thing.

from audited.

yzhanginwa avatar yzhanginwa commented on August 25, 2024

My workaround is to define virtual attribute "version" in the to be audited model:

  def version=(value)
    write_attribute(:version, value)
  end

  def version
    read_attribute(:version)
  end

from audited.

kennethkalmer avatar kennethkalmer commented on August 25, 2024

I'll take a stab at this. The general assumption was that you wouldn't have a separate version column in the model you're auditing since the versioning is delegated to acts_as_audited.

from audited.

yzhanginwa avatar yzhanginwa commented on August 25, 2024

I had the version column in a model before I wanted to apply acts_as_audited. I could rename it but the above workaround could avoid code changes in many places. In the same time, I wonder if it's better not to define extra methods on a model if possible.

from audited.

joonty avatar joonty commented on August 25, 2024

I've just run into exactly the same issue. Took me a while to work out why my application stopped working after adding auditing to one of my models, but this was it - the version method that audited added returns nil, which breaks things.

πŸ‘ for not defining extra methods on the model!

from audited.

laserlemon avatar laserlemon commented on August 25, 2024

Hi there! We’re doing some open source maintenance work and closing old issues. If you would still like this PR to be merged in, please re-open it by 2-weeks-from-today. Thanks!

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.