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

Factory callbacks now return self #866

Merged
merged 1 commit into from
Aug 13, 2022
Merged

Factory callbacks now return self #866

merged 1 commit into from
Aug 13, 2022

Conversation

jwoertink
Copy link
Member

Fixes #865

You can now use these like this:

class UserFactory < Avram::Factory
  def with_friends
    after_save do |user|
      FriendFactory.create &.user_id(user.id)
    end
  end
end

UserFactory.create &.with_friends

@jwoertink jwoertink merged commit ef8bad1 into main Aug 13, 2022
@jwoertink jwoertink deleted the issues/865 branch August 13, 2022 16:57
@paulcsmith
Copy link
Member

This is awesome!

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

Successfully merging this pull request may close these issues.

Should Factory callbacks return self instead of Nil?
3 participants