Git Product home page Git Product logo

Comments (5)

fatkodima avatar fatkodima commented on May 25, 2024 1

This was changed in #51139 (cc @byroot).

In the meantime, this works:

    assert_equal([p], Post.where("ratings @> ?", '{4}'))

from rails.

matthewd avatar matthewd commented on May 25, 2024

Frankly, I feel like this is a [largely accidental] feature -- interpolating ? values into a string literal seems scary and dangerous and deeply inadvisable.

I also don't think there's much we can do about it: it's not reasonable for us to guarantee the exact characters that will be interpolated... at that point you might as well use #{}.

from rails.

Earlopain avatar Earlopain commented on May 25, 2024

I won't be heartbroken if this doesn't work anymore. Rails only documents the ARRAY[?]::type[] notation at https://guides.rubyonrails.org/active_record_postgresql.html#array and its trivial to change the few occurrences to that.

A basic GitHub code search yields some results though, see here, so deprecation/better error message? I don't know if this warants that.

from rails.

byroot avatar byroot commented on May 25, 2024

Yeah, I think we can close this. I don't think a specific deprecation would be helpful or needed, this seems extremely niche.

from rails.

Earlopain avatar Earlopain commented on May 25, 2024

Just for posterity, a better replacement for my case above would be where("? = ANY(ratings)", 4) since only one element is being checked for. The array notation makes sense when checking again multiple elements.

from rails.

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.