How to add after_action method

Hello Forest,
I would like to know how I can add an after_action method to be called after I create a record through the ForestAdmin data panel?

I am using Rails, maybe it’s possible to override the Forest controller to add an after_action method?

I created a smart action for now, but it requires each time to click on the smart action button. I would like to automatically call my method after creating a record.

Thanks for your help.

Hello @nico_lrx :wave:

Your records are Active Records so you can use all their lifecycle callbacks. In your case I think you would use after_create.

Let me know if it works :wink:

1 Like

Hello @anon15528774,
Thanks for your answer. Indeed, it works! :partying_face:

I thought I had to do it in the controller but it makes sense to put it in model.

Have a good day!