GithubHelp home page GithubHelp logo

Comments (4)

owst avatar owst commented on June 3, 2024

Similarly to this comment #663 (comment) adding this before the test "fixes" the test:

CanCan::RulesCompressor.class_eval do
  def compress(array)
    # Don't compress...
    array
  end
end

from cancancan.

a-chris avatar a-chris commented on June 3, 2024

I just wasted a few hours fighting with this error today 😔

from cancancan.

a-chris avatar a-chris commented on June 3, 2024

Similarly to this comment #663 (comment) adding this before the test "fixes" the test:

CanCan::RulesCompressor.class_eval do
  def compress(array)
    # Don't compress...
    array
  end
end

This solution didn't work for me, I figured out the problem is the StiNormalizer introduced in #649 so a possible solution could be to go back to the 3.1.0 version.

At the end I prefered to overwrite the StiDetector class to that it stops adding the type = ... filter to the query only for the models I need

class StiDetector
  class << self
    alias_method :sti_class_original?, :sti_class?

    def sti_class?(subject)
      if subject == MyModel
        false
      else
        sti_class_original?(subject)
      end
    end
  end
end

from cancancan.

rvalladares77 avatar rvalladares77 commented on June 3, 2024

I am getting the same issue for some reason cancancan 3.5.0 is adding an extra where condition type="'.

This patch worked fine: #663 (comment)
But it breaks another part of my app. :(

System configuration

  • Rails version: 6.1.7
  • Ruby version: 2.7.7
  • CanCanCan version 3.5.0

from cancancan.

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.