Problems with implementation of dynamically updating scores


I’m implementing a “digg-like” page, that once you digg. The score for
each item will dynamically reflect your current action +1 .

I am not sure what’s
In the controller I have an action responsible for increase of the
score.It has a corresponding rjs in view.

def arouse
[email protected]?
puts fair

if fair
puts ‘success’
@p.popular_score +=1
puts “add”
@li =
@li.product_id =params[:id]
@li.list_id [email protected]
@li.likeornot =1
@li.created_at =
puts “line”
redirect_to_index(“推文成功”) --> never worked, why?

redirect_to_index(“一人只有一票唷”) --> never worked, why?



In the view, I have a div displaying the score.

            <% if product [email protected] %>
<div id="current_product">
<%= render(:partial => "score", :object => @p) %>
<% else %>
<div class="score">

<%= product.popular_score %>
<% end %> </div>

In arouse.rjs

page[:current_product].replace_html :partial => ‘score’, :object => @p

In _score.rhtml

<%= @p.popular_score %>

These are pretty much the setting.
But it just does not update the new score as I call the arouse with
Is there anything I’m missing here?

Any suggestion and ideas are high welcomed.