Custom rails validations not executed

hello,

i have forest admin hooked up to my rails app.
i have some model validations that execute on creation of a new record. unfortunately i noticed that these validations don’t run when i create a record on forest admin.

is there away that i can activate these validations?

Hello @huss,

Thanks for you message.

Did you try to override the POST route to make it go through the validations?
You can find some documentation about it here.

Thanks!

so there isn’t a simpler way to achieve this goal?

like predefined validations do run, but custom ones do not.
as you can see in the image below i have one predefined validation and two custom ones below it. the custom ones would normally execute a function on creation of a record along with the rest of the validations but with forest admin they do not execute at all.

so basically my question is, is there not an easier way to achieve this other than the suggestion above?

thank you!

Hello @huss,

To my knowledge, this should be supported.

Would you mind sharing your model file source code so I can try to reproduce your issue properly?

hello,

this is my model file with the validations.
the validates_presence_of :start_date, :end_date validation executes fine
but the next two custom validations do not.

how do i make these validations work?

Hey @huss :wave:

I just did this quick test

image

And everything seems to work as expected on my end.
Eventually, could you try to only keep one of the validate clause (Instead of the 3) just to check if they individually run?

In the meantime I’ll look at the code responsible for this on my end, and i’ll let you know if I can spot any issue there.

Thanks in advance.

1 Like

i tried them individually and they work. and now they all work together as well. im not really sure why they didn’t work before.

thank you so much for your help, and i apologize for wasting your time :grimacing:

1 Like