Hi,
I am trying to get a partial to update on a page, but I can't get it to work.
Here's the relevant part of my controller:
def update_deleted @listing = Listing.update(params[:id], :deleted => "1", :position => "0") end
Here's the relevant part of my view:
<%= render :partial=>"deleted_web_list" %>
Here's the partial _deleted_web_list.rhtml:
<div id="deleted_web_listing" class="left_column_listing"> <%= render :partial=>"show_deleted_web_listings" %> </div>
Here's the partial _show_deleted_web_listings.rhtml:
<% for listing in @deleted_listings %> <div class="box_left"> <div class="x_image"> <%= link_to_remote(image_tag("restore.gif", :size => "44x13", :border => "0" ), :url => { :action => 'restore_deleted' , :controller=> :admin, :id => listing.id}) %> </div> <div class="search_result_url_to_show"><%= h(truncate(listing.url_to_show, 22)) %></div> <div class="search_result_description"><%= h(truncate(listing.description, 35)) %></div> </div> <% end %>
When I perform the action "update_deleted" in my controller, the database updates properly.
When update_deleted.rjs looks like this, I see this replacement text without refreshing my browser:
page.replace_html 'show_deleted_web_listings' , '<div>this is the replacement text</div>'
But when I try to use my partial to replace text, it does not work. The database updates properly, but my partial _deleted_web_list.rhtml does not show up, completely refreshed, when I perform my action "update_deleted" -
page.replace_html 'show_deleted_web_listings' , :partial => 'deleted_web_list'
Any ideas?
Charlie