I recently upgraded my Rails application from version 6 to version 7. In my form, I allow users to upload images, which was working correctly before the upgrade. However, after the upgrade, when I try to upload a second image after returning to the form, I encounter the following error:
“Can’t verify CSRF token authenticity.”
I have tried to bypass this error using the skip_before_action :verify_authenticity_token option, but I understand that this practice may pose security issues.
How can I resolve this issue without compromising the security of my application?
I appreciate any guidance or suggestions on how to address this problem safely and effectively. Thank you very much for your help!