I am trying to show a counter of comments in the header of my site with several options:
ul
= sync_new partial: "show", resource: Commontator::Comment.new
/ also with
ul
= sync partial: "show", resource: Commontator::Comment.new
/ also with
ul
= sync_new partial: "show", collection: Commontator::Comment.all
/ also with
ul
= sync partial: "show", collection: Commontator::Comment.all
On my partial:
li
a = comment.class.all.size
I am not clear about the differences between sync_new
and sync
.
What I understand:
Maybe I should go in a totally different direction, like using Faye directly. Any advice is appreciated.
Also posted here.
I will create a counter cache so when a new comment is posted the cache changes. I will render the model with the cache using:
= sync partial: 'discussion', resource: discussion
Then, when a comment is created, edited, deleted, partial should update. This will be the partial:
li
ul
- discussion.thread.comments.each do |comment|
li = comment.body