I know this is a little late but I just had to solve this problem so hopefully my response can help someone else. Basically, since my form is a create action, I edited my create.js file to update the token on failed submission. Here's how:
Here's a portion of my form where I render a partial that include my captcha tag:
Japanese translator turned software engineer. I work mostly with Ruby and Rails, but love working on both the backend and the frontend. Currently a computer science student @ University of Colorado.
Location
Connecticut
Education
University of Colorado, Ohio State University, IUC (for Japanese)
I know this is a little late but I just had to solve this problem so hopefully my response can help someone else. Basically, since my form is a
create
action, I edited mycreate.js
file to update the token on failed submission. Here's how:Here's a portion of my form where I render a partial that include my captcha tag:
Here's the complete partial:
potential_clients/captcha_field
:Finally, in my
create.js
I do the following:This will re-render the portion of the form with the token and since it hits the helper function, a new token is generated!
Nice! Thank you so much for sharing your solution!