turbolinks / turbolinks-ios

Native iOS adapter for building hybrid apps with Turbolinks 5
MIT License
881 stars 92 forks source link

form Post not working #70

Closed leonardoprg closed 7 years ago

leonardoprg commented 8 years ago

Hello guys,

I'm using turbolinks-ios on my rails app. My Rails app is using devise to manage user auth.

the problem is, if I just run visit(URL: URL(string: "http://localhost:3000")!) if works on the devise form, I put email and password, submit, and it redirects to root_path, but the links on the app, doesn't works.

But, when I use session.delegate = self to manage sessions, the devise form POST stop working, and links on the apps, start working.

Any Idea?

edit: When using session.delegate = self, and click on button, the server hasn't receiving nothing.

jun1st commented 8 years ago

did you ajaxly submit your form?

jakobdamjensen commented 8 years ago

We're using devise on our app as well. I had to make a custom SessionsController and make the form remote: true for it to work properly.

ghashi commented 7 years ago

@fabiothiroki @serradura and myself have developed an open source project which has an integration with devise. You can see our solution (server, ios and android) here: https://github.com/themasterapp

Hope it helps! =)

ps: @leonardoprg, We've also given a talk about using Turbolinks here in São Paulo. It is in portguese but it seems that you're from Portugal, so I think you can see it and understand everthing ;) https://www.youtube.com/embed/NfucOzndumU?t=2h43m

zachwaugh commented 7 years ago

Thanks for the info @ghashi! I don't use devise, so I can't comment on any particular issues there. But in general you should always submit forms with ajax, and then issue a Turbolinks.visit(...) in the server response to tell the app where to go next - https://github.com/turbolinks/turbolinks-ios#handling-form-submission