ryanb / private_pub

Handle pub/sub messaging through private channels in Rails using Faye.
MIT License
864 stars 228 forks source link

Published content gets posted twice to the DOM, but is saved to db correctly #42

Closed Preacher closed 12 years ago

Preacher commented 12 years ago

I'm set up similarly to the basic setup shown on the readme and in the Railscast, with the only exception being that I have to have a dynamic subscribe_to/publish_to channel. When I submit my form the published content gets appended twice to my ul. Checking the database or refreshing the page reveals that it was accurately saved to the database only once.

Any ideas? If I need to gist some code, I can do so.

Preacher commented 12 years ago

Oddly enough, I stumbled on something that fixed the issue. I had the subscribe_to method in my view placed after the ul that contained the messages, followed by the form. Apparently that can't work. I put the subscribe_to method directly after the form and all seems to be fine now.

mareczek commented 12 years ago

I don't think this is the solution. I also have this problem that i receive notification twice and i have the subscription helper at the very top of the view

mariusbutuc commented 11 years ago

Had the same issue, but for for me it was caused by the fact that the jQuery ujs AJAX requests were triggered twice. And this was because I had the assets precompiled locally.