thams / db_fixtures_dump Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
If the database contains many objects, the yml dump file will contain ---
to separate each item, and this string will lead yml load finish.
So the loader can NOT find the second and more objects.
well first of all, great idea. I used to use yaml_db but since fixtures are baked into AR, providing the missing dump is all i need.
The symptom: Loading a dump only ever loads one object per table.
This seems to be because of the "new" string replacement not working (for me)
Having looked at the code, you could just simplify it by creating a hash of the array of objects and just dumping the hash into the file. Saves the loop and the string replacement and is actually what you want, as AR loads a hash.
I can do a pull if you want (and will accept it)
a version without OPTION EXCLUDE_MODELS is published on rubygems.
This is a bit more tricky, don't know if you use store attributes. http://api.rubyonrails.org/classes/ActiveRecord/Store.html
Basically they allow you to store a hash in a column. And they let you use different encodings, default being YAML. I recently read that that is unsafe and switched to JSON.
But it seems AR stores the data as a HASH and just dumping it as yaml will off course serialise it as yaml.
So when it loads it it gets the yaml string into the db, but AR can't then access the objects anymore because it gets a yaml string where it expects a json string and bang!
I would suggest a small warning for starters and YAML as a workaround.
More elaborate schemes call for some kind of encoders, or maybe just going through the attributes types . . . . .
When I pulled the current gem it didn't include "excludes".
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.