Comments (7)
@skalee can you help fix this? Thanks!
from activeid.
Ping @skalee
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.
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.
@kevinwongso doesn't this mean we can just use the binuuid gem and get rid of activeuuid? Can you try?
from activeid.
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.
Right, but it might be easier to fix that approach than to redo this. Letβs see what happens!
from activeid.
#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)
- Gem name and metadata HOT 36
- Build failures on master HOT 1
- Bring back support for Rails 4.2 HOT 1
- Rearrange UUIDs before storing them (for efficiency)
- Use UUID_TO_BIN() and BIN_TO_UUID() in MySQL
- Support Rails 6
- Improve API for generating various versions of UUIDs
- Railtie is not tested properly
- Joined tables problem HOT 10
- Make clear in README to explicitly declare all UUID columns
- Change Travis tests to GHA HOT 3
- Fix GHA builds HOT 3
- Broken tests on Ruby 2.3 HOT 2
- Broken tests for SQLite3 backend on JRuby
- Broken tests for Postgres backend on JRuby
- Remove support for Rails < 5 and Ruby < 2.5 HOT 4
- Release as ActiveID HOT 1
- Enable Rubocop tests in GitHub Actions HOT 1
- Test against TruffleRuby
- Upgrade to support Rails 6 and Rails 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activeid.