Hi,
I am having the following scenario to . In a page I have a list of
stories, I would like to add the voting fuctionality (digg style) for
each stories. I need the voting score to be displayed simultaniously
(using AJAX). I am using the following listed code snippet for this
but, I have a minor problem, since I am updating the <span
id="vote_score" ..> using the vote.rjs. It always updates the score of
first story only. Does anyone has any solution for this. Thanks in
advance
_story.html.erb
--------------------------------
<% div_for story do %>
<h2><span id="vote_score"> <%= story.votes.size %></span>
<span id="vote_link" >
<%= link_to_remote 'Vote Up', {:url => {:action => 'vote', :id =>
post.id}},
{:href => url_for(:action => 'vote', :id => story.id)}%>
<%= link_to_unless_current h(post.title), story %> </h2>
<%= simple_format h(story.body) %>
</span>
<% end %>
--------------------------------
vote.rjs
------------------------------------------------------------------------------
page.replace_html 'vote_score', "#[email protected]}"
page[:vote_score].visual_effect :highlight
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---