ryanb / private_pub

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

jquery.append() multiple times #73

Closed remon closed 11 years ago

remon commented 11 years ago

I user private_pub gem on my rails app I am using pjax also i have a form submitted with ajax and on my create.js.erb file I have these code

<% publish_to "/posts/#{@message.post.id}" do %> $('ul#comments<%=comment.id%>').append('<%= escape_javascript (@comment)%>') <% end %> comments are appended many time when I remove the publish_to method or reloading the page it working good these issue made me crazy

remon commented 11 years ago

these code is on a div loaded by jquery.load() every time I load the div ,,jquery.append() increased by once ..when I remove publish_to ..jquery.append() working good ...