Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

association documentation #601

Closed
rubydesign opened this issue Jan 21, 2014 · 2 comments
Closed

association documentation #601

rubydesign opened this issue Jan 21, 2014 · 2 comments

Comments

@rubydesign
Copy link

I'm just starting out and feel I had to google a little bit too much to build a factory that has a simple has_many association.

Not only is the Getting started on the subject wrong but also many a link points there as an explanation.

By wrong i mean when i do as it says, my association will _not return objects, only the length (as it states)

To get an actual association I found this kind of code

FactoryGirl.define do
factory :listing_with_features, :parent => :listing do |listing|
features { build_list :feature, 3 }
end
end

which does exactly what one (one newbie that is) expects and wants.

I would offer to write this up, but i don't feel on solid ground with it, so i hope someone else will improve the docs.

thanks , Torsten

@drapergeek
Copy link
Contributor

Can you provide more insight into what part doesn't actually work?

The documentation that is specified is given primarily as a way for you to provide a number of how many of the associated records you'd like to create. The way you have it above works great but is not flexible enough to specify the number of attributes so the document lays out the way to do that.

@rubydesign
Copy link
Author

Hi @drapergeek, i honestly can not remember what this was about.
I mean, as it reads, it was meant to provide a beginners perspective on missing documentation.
But i got it done, moved on, and forgot.
I'll close it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants