I'm using link_to_remote to update a div asynchronously, but it does not work. I have to refresh the page in order to see the change.
I use this to generate the links. http://ruby.pastebin.com/m1d83be81
"padding-left:30px", :display => "table-row" ) do %>
{ :success => 'entry_' + entry.id.to_s},
:url =>{ :controller => :entries, :action => :increment ,:id => entry.id},
:with => "'amount=' +prompt('Amount')")%>
{ :success => 'entry_' + entry.id.to_s},
:url =>{ :controller => :entries, :action => :decrement ,:id => entry.id},
:with => "'amount=' +prompt('Amount')")%>
{ :success => 'entry_' + entry.id.to_s},
:url =>{ :controller => :entries, :action => :update ,:id => entry.id},
:with => "'amount=' +prompt('Amount')")%>
The corresponding actions all look like this:
def increment
@entry = Entry.find(params[:id])
@entry.amount += params[:amount].to_i
@entry.save!
render :partial=>"entry", :object=>@entry
end