Giter VIP home page Giter VIP logo

Comments (7)

ronaldtse avatar ronaldtse commented on July 30, 2024

@skalee can you help fix this? Thanks!

from activeid.

ronaldtse avatar ronaldtse commented on July 30, 2024

Ping @skalee πŸ‘ I think @ribose-jeffreylau 's work is in the "rails5-wip" branch.

We need to bring Rails 5.1 compatibility to this gem, and perhaps we can somehow meld this with the Rails 5.1 approach of UUID -- seems that the only difference is that Rails uses string for UUID but we use a binary(16) field. This involves:

  • Dumping of the db/schema.rb
  • Models should provide an ID that is a UUID model read from whatever "UUIID representation" stored in the datastore (which could be .to_s to a String)

from activeid.

kevinwongso avatar kevinwongso commented on July 30, 2024

This might be relevant:
https://blog.metova.com/rails-5-attributes-api

And this gem seems to be an example of someone's attempt to use Rails 5 Attributes API to achieve something similar to ActiveUUID:
https://github.com/nedap/mysql-binuuid-rails
Though, according to a test case someone added, the gem still can't handle conversion from complex queries due to how Attributes API works, so pure Attributes API may not be enough.

from activeid.

ronaldtse avatar ronaldtse commented on July 30, 2024

@kevinwongso doesn't this mean we can just use the binuuid gem and get rid of activeuuid? Can you try?

from activeid.

kevinwongso avatar kevinwongso commented on July 30, 2024

I'll try checking what the gem is trying to do, and see if we can apply it to activeuuid or if it's enough to just use the gem to replace activeuuid. I'm concerned about the failed test case discussed on that gem as our own projects that use activeuuid have non-trivial SQL queries that may fail similarly.

from activeid.

ronaldtse avatar ronaldtse commented on July 30, 2024

Right, but it might be easier to fix that approach than to redo this. Let’s see what happens!

from activeid.

kevinwongso avatar kevinwongso commented on July 30, 2024

#cfad7646caed5732a73c2166886af0ab010eb993
Seems to fix it for Rails 5.1, issue seems to be that the Patches module that ActiveUUID prepends to register the types had an if statement that checks for Rails major & minor versions. It wasn't updated for 5.1, so there was a step that is only executed if Rails major version is 5 and the minor version is 0. Running it in a Rails 5.1 environment thus skips that step. I changed the if statement to run that step in 5.1 too, and added a "cast" method to the UUID type that 5.1 seems to look for.

After these changes, the models seem to work fine again and properly return a UUIDTools::UUID instance when .id is invoked.

from activeid.

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.