Giter Site home page Giter Site logo

Comments (4)

ktheory avatar ktheory commented on May 18, 2024

Hi Pupeno,

It may be difficult or impossible to change acts_as_audited to do this.

AFAIK, here's the order how methods are defined on ActiveRecord classes:

  1. The class is interpreted. Any methods defined using "def my_method" are added to the class. As modules are included, their methods are added to the class.
  2. When the interpreter reaches the acts_as_audited line, it includes the appropriate modules, which define some methods.
  3. After the class is loaded, ActiveRecord inspects the database schema, and defines accessor methods for attributes.

So even if acts_as_audited checked if methods were already defined, it wouldn't prevent the case where ActiveRecord later tries to define methods based on the database schema.

from audited.

pupeno avatar pupeno commented on May 18, 2024

I see, I haven't realize that... mmhh... it seems like Rails should check whether the methods exist then. That's not likely to happen :/

Maybe checking if the method exists and checking the schema would do it, but I'm not even sure if that's possible.

from audited.

rewritten avatar rewritten commented on May 18, 2024

Late comment, but anyway... One could do with some code to remap generated method names like
acts_as_audited :methods => {:versions => :audit_versions}

this way a user who knows that some name will clash can preemptively change it.

from audited.

laserlemon avatar laserlemon commented on May 18, 2024

@pupeno, we're cleaning up some of our stale issues. Is this still an issue for you? Thank you!

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.