Skip to content

Commit

Permalink
Fix before hooks in instance_hooks not to exit early if they return f…
Browse files Browse the repository at this point in the history
…alse value
  • Loading branch information
jeremyevans committed Aug 1, 2017
1 parent f022437 commit 1e4f07e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sequel/plugins/instance_hooks.rb
Expand Up @@ -37,7 +37,7 @@ def #{h}_hook(&block)
end
END

[:before_create, :before_update, :before_validation].each{|h| class_eval("def #{h}; (@instance_hooks && run_before_instance_hooks(:#{h}) == false) ? false : super end", __FILE__, __LINE__)}
[:before_create, :before_update, :before_validation].each{|h| class_eval("def #{h}; run_before_instance_hooks(:#{h}) if @instance_hooks; super end", __FILE__, __LINE__)}
[:after_create, :after_update].each{|h| class_eval(<<-END, __FILE__, __LINE__ + 1)}
def #{h}
super
Expand Down

0 comments on commit 1e4f07e

Please sign in to comment.