Code Monkey home page Code Monkey logo

Comments (5)

thomasfedb avatar thomasfedb commented on August 27, 2024

Here's an example of this issue in action:

irb(main):015:0> Tutorial.find("R-SKC ").id
=> "R-SKC "
irb(main):019:0> Tutorial.find("R-SKC ").to_global_id.to_s
=> "gid://tenjin/Tutorial/R-SKC "
irb(main):020:0> GlobalID.parse("gid://tenjin/Tutorial/R-SKC ")
=> nil

from globalid.

kaspth avatar kaspth commented on August 27, 2024

I'm not sure how common this is. Does overriding to_global_id in your model work? You'd probably need a custom locator to whip the model id back into shape.

from globalid.

matthewd avatar matthewd commented on August 27, 2024

@kaspth needing to support trailing spaces might be an edge case, but that's what encoding schemes are for.

AIUI, we're currently insisting (well, assuming) that all identifiers contain only characters that are safe unescaped in a URL path segment. Are we deriving some benefit from that restriction, beyond not having to call a method? 😕

from globalid.

thomasfedb avatar thomasfedb commented on August 27, 2024

@kaspth I think this is less a case of 'trailing spaces are weird, why would anybody need that' and more a case of the fact that ActiveRecord supports a far wider range of values as IDs than GlobalID. It would be nice to fix that.

Also, for the majority of cases, urlencoding the ID should be backwards compatible.

from globalid.

kaspth avatar kaspth commented on August 27, 2024

@matthewd @thomasfedb Sorry for being slow here. You're both right, and Active Record supporting many more types of ids is why we should fix this.

@thomasfedb would you be interested in opening a PR? 😄

from globalid.

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.