Git Product home page Git Product logo

Comments (5)

dgm avatar dgm commented on July 28, 2024
        options = {:protect => accessible_attributes.nil?}.merge(options)

If I'm looking at this right, accessible_attributes is never nil, but might be empty. Without acts_as_audited loaded:

ruby-1.9.2-p0 > Email.accessible_attributes
=> #<ActiveModel::MassAssignmentSecurity::WhiteList: {}> 
ruby-1.9.2-p0 > Email.accessible_attributes.nil?
=> false 
ruby-1.9.2-p0 > Email.accessible_attributes.empty?
=> true 
ruby-1.9.2-p0 > Email.accessible_attributes.count
=> 0 

from audited.

 avatar commented on July 28, 2024

Have you got a fix for this yet? This happens to me as well: Rails 3.0.3
With acts_as_audited loaded, I get the audit_comment in the whitelist (which means everything else is blacklisted, I guess).

If it is not loaded, the white list is an empty hash and I can save my models fine.

from audited.

 avatar commented on July 28, 2024

Just swapped

acts_as_audited :protect => false
for
acts_as_audited :protect => true

and the mass-assign error is gone. The whitelist hash stays empty, even with a_a_a loaded.

from audited.

dgm avatar dgm commented on July 28, 2024

This was an issue I fixed in the pull request in issue 36 - I hadn't specified any accessable or protected attributes but got this error. I discovered that the list was always defined, but empty, so the code needs to check empty? instead of nil?

from audited.

kennethkalmer avatar kennethkalmer commented on July 28, 2024

Closing this one since it has been resolved in #36 and is in the current RC.

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.