troessner / has_uuid Goto Github PK
View Code? Open in Web Editor NEWA Rails gem that lets you easily assign an UUID to your models.
License: MIT License
A Rails gem that lets you easily assign an UUID to your models.
License: MIT License
Right now we are using two callbacks unconditionally to generate the uuid: 6fb3387#L1R23
Back then I was ok with it, however, thinking about it now I am not so sure that we should do this anymore.
Why did we add it in the first place?
Well, apparently there is no AR callback that gets triggered before the before_validation
even if we do not validate the object.
So there could (and has in our applications) arise the following cases:
a) Say we only use "before_validation"
b) We only use "before_save"
So, as kind of a workaround we just added both callbacks.
I think this isn't good for one reason:
Inefficiency. We're talking about adding and executing one more callback than actually necessary.
A better solution:
I think we should remove the "before_save" callback and make it prominent in the documentation: "If you do NOT validate an object, you need to manually call assign_uuid
". Also, we would have to adjust our code that uses it (right now I can only think of one, possibly two places in the nucleus).
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.