factory-girl icon indicating copy to clipboard operation
factory-girl copied to clipboard

Add a few notes about model objects

Open michaelgwelch opened this issue 3 years ago • 0 comments

I struggled to figure out how to use factory-girl, because the tutorial and README make no mention of how the factory interacts with the model. What I learned is that it calls the constructor of your model and passes in a single object that is used to instantiate the model object.

Perhaps this is obvious to others but as someone that doesn't do a tremendous amount of JavaScript development I was confused as to why the factory created an instance of my model and that this was being nested inside of just one of my properties of the model. (My model classes had constructors with arguments for each property.)

This is a proposal to make an addition to the README and tutorial that just shows what a model class might look like.

michaelgwelch avatar Jul 09 '21 00:07 michaelgwelch