I have a PR where I want to do something after each row gets processed. Specifically, I want to create a Contact::AppliedTag record after each row is successfully uploaded.
I originally thought after_each was the go-to method. However, this method runs after every record gets processed, whether it is successful or not.
So there are two changes here:
mark_row_processed was renamed to after_row_processed
We are passing an active record object to the method, so that we can use it to do more things, like creating an associated AR object. For instance, here is my override that I will include in a PR to create a Tag on row create:
def after_row_processed(record)
super
record.applied_tags.create(tag: tag)
end
This needs to be merged before we can merge https://github.com/clickfunnels2/admin/pull/15864.
I have a PR where I want to do something after each row gets processed. Specifically, I want to create a
Contact::AppliedTag
record after each row is successfully uploaded.I originally thought
after_each
was the go-to method. However, this method runs after every record gets processed, whether it is successful or not.So there are two changes here:
mark_row_processed
was renamed toafter_row_processed
We are passing an active record object to the method, so that we can use it to do more things, like creating an associated AR object. For instance, here is my override that I will include in a PR to create a Tag on row create: