Skip to content

Commit

Permalink
add_before_build_callbcak
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammednasser-32 committed Aug 30, 2024
1 parent c000b9e commit edf9fae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/factory_bot/strategy/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def association(runner)

def result(evaluation)
evaluation.object.tap do |instance|
evaluation.notify(:before_build, instance)
evaluation.notify(:after_build, instance)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/factory_bot/strategy/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def association(runner)

def result(evaluation)
evaluation.object.tap do |instance|
evaluation.notify(:before_build, instance)
evaluation.notify(:after_build, instance)
evaluation.notify(:before_create, instance)
evaluation.create(instance)
Expand Down

0 comments on commit edf9fae

Please sign in to comment.