Comments (4)
You should be doing this the other way around. Always build from the top down.
Given the following author:
| name | John Doe |
And that author has 1 book
from fabrication.
I don't think authors are "on top of" books in this example - they "have many through" each other. But agree with you that coming from the other direction would solve this problem.
from fabrication.
Oh, you are absolutely right. Sorry about that.
The base fabricator should never build things that aren't necessary to persist the object. You should make a :book_with_author fabricator for when you need them together. This will reduce the "magic" in your test suite and make cucumber work a lot better.
from fabrication.
Makes a lot of sense. Thanks!
from fabrication.
Related Issues (20)
- Configure fabricators directory HOT 1
- The https://www.fabricationgem.org isn't working HOT 6
- Why does Fabrication::Generator::Base#post_initialize exist? HOT 1
- Docs: defining fabricators for namespaced models HOT 2
- Rake HOT 1
- [Proposal]Custom return value HOT 4
- Fabricator rand minimum? HOT 3
- fabricate failing to build interit values for nested associations through nested attributes HOT 1
- postgres error with complex class_name HOT 1
- [Regression] Can't fabricate model with polymorphic belongs_to anymore HOT 3
- Find models in another folder HOT 1
- Where to extract methods ? HOT 3
- Models with deep namespace HOT 2
- Won't let me run `rails console` with the error: 'model_name' is already defined when implementing for rspec factories HOT 4
- Provide meaningful error for circular references
- ActiveRecord view backed model with custom primary key HOT 1
- Is this project dead? HOT 5
- Error destroying new Rails model HOT 4
- Site fabricationgem.org down: SSL issues? HOT 6
- Sequel ORM backend raises error with Fabrication HOT 1
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 fabrication.