hair_trigger
hair_trigger copied to clipboard
Rails 8 migration issue, duplicate before(:update)
I have this in my model:
trigger.before(:insert).before(:update) do
When I generated the migration I got this:
create_trigger("exercises_before_update_row_tr", :generated => true, :compatibility => 1). on("exercises"). before(:update). before(:update) do
HairTrigger currently expects each method to be called at most once, so you can work around this be changing your to this:
trigger.before(:insert, :update) do
That said, ideally HairTrigger should either 1. handle multiple calls or 2. throw an error in this case, since the current behavior is not ideal. So we can keep this issue open until that's resolved, PRs are welcome!