ajax - Rails 4 Login/Sign up using devise during form submission authenticity token error -


i have project model. there's one-to-many association project model , devise user model. want users perform ajax login using devise before submitting projects form data.

the ajax login works fine. but, after login when try , submit projects form authenticity token error. understand due change of session token change. wonder if there's way maintain kind of user flow?

i think fixed simple jquery code. needed replace existing authenticity token on parent form new 1 after sign in. had enabled devise session method respond js format , had file /devise/sessions/create.js.erb.

on same file had append following jquery code replace existing authenticity token on form new 1 generated after logging in.

$("input[name='authenticity_token'").val("<%= form_authenticity_token %>"); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -