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

calling make or make! on an association does not set the new object's association to the calling object #116

Open
xxx opened this issue Jun 28, 2012 · 4 comments

Comments

@xxx
Copy link

xxx commented Jun 28, 2012

This is easier to demonstrate than describe. I'm not sure if this is a feature or bug, but it works correctly in Machinist 1.

User has_many :posts
Post belongs_to :user

Post.blueprint do
  user
end

@user = User.make!

@new_post = @user.posts.make!

@new_post.user_id == @user.id # false in v. 2, true in v. 1
@opsb
Copy link

opsb commented Jul 30, 2012

Yeah, this has been bugging me. Here's a workaround I've been using...

@user.posts.create Post.make.attributes

@mikecx
Copy link

mikecx commented Apr 22, 2013

+1 on getting this fixed.

@sumitngupta
Copy link

+1

1 similar comment
@binarylogic
Copy link

+1

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

5 participants