-
Notifications
You must be signed in to change notification settings - Fork 134
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
Blueprint for has_one associations #96
Comments
In Machinist 1, only belongs_to associations can be filled in like this; for has_one/has_many associations, you need write a manual helper. See the section 'Other Associations' in the README: https://github.com/notahat/machinist/blob/1.0-maintenance/README.markdown I believe the plan is for Machinist 2 to support has_one/has_many associations using this syntax. |
Sorry - I forgot to mention that I am using machinist 2. |
Using 2.0.0.beta I have the same problem with belongs_to using an explicit make! fixes the problem So try: |
Antipattern's solution works for us, but when not when using make from an association: Like: i = recipe.ingredients.make! i.recipe_id will != recipe.id (rails 3.1.3, machinist 2) |
To have makes via associations work, I usually write my blueprints like so:
|
I tried that freelancing god, and it didn't work! What ruby version and rails version are you using? |
Generally using MRI 1.9 and Rails 3.x - I've taken this approach in a few apps. |
I tried making a blueprint for a has one association (where User has_one Profile:
But they don't seem to work. I can't find any info regarding this either. Is this thing possible?
The text was updated successfully, but these errors were encountered: