Forum: Ruby on Rails help with partials

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2007-06-03 02:11
(Received via mailing list)
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
Keynan P. (Guest)
on 2007-06-03 10:06
just

replace_html 'show_deleted_web_listings' , :partial =>
'deleted_web_list'

no page.
(Guest)
on 2007-06-06 05:38
(Received via mailing list)
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>
This topic is locked and can not be replied to.