Help with partials


#1

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:

<%= render :partial=>"show_deleted_web_listings" %>

Here’s the partial _show_deleted_web_listings.rhtml:

<% for listing in @deleted_listings %>



<%= link_to_remote(image_tag(“restore.gif”, :size =>
“44x13”, :border => “0” ),
:url => { :action => ‘restore_deleted’ , :controller=> :admin, :id =>
listing.id})
%>

<%=
h(truncate(listing.url_to_show, 22)) %>

<%=
h(truncate(listing.description, 35)) %>


<% 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’ , ‘

this is the
replacement text

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


#2

just

replace_html ‘show_deleted_web_listings’ , :partial =>
‘deleted_web_list’

no page.


#3

Hi, thanks. This does not work for me. I get this error:

ctionView::TemplateError (undefined method `replace_html’ . . .

On Jun 2, 11:06 pm, Keynan P. removed_email_address@domain.invalid