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. Currently a post-bacc 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
createaction, I edited mycreate.jsfile 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.jsI 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!