Forum: Ruby on Rails Re: Re: page.replace_html "#{var_containing_id_name}", :part

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.
Jason T. (Guest)
on 2006-04-07 21:43
(Received via mailing list)
> remember, the view templates have access to the attributes defined
> in the controller

Actually, its more like this: I have a list page. Each row is a div
whose id is the id of the record it represents. When you click on the
'edit' link in a row, I want to page.replace_html the div for that
record. The only way I know the id of the div is from params[:id]

Unfortunately,

page.replace_html params[:id], :partial => "edit"

doesn't work.

: )

Jason
Chris H. (Guest)
on 2006-04-07 21:52
(Received via mailing list)
def show_edit_form
  @user = User.find(params[:id])
end

show_edit_form.rjs
  page.replace @user.id, :partial => "edit_form"
end

_edit_form.rhtml

<%= start_form_tag :action => :update %>
<%= text_field :user, :name %>
...
<%= end_form_tag %>
Chris H. (Guest)
on 2006-04-07 21:55
(Received via mailing list)
typo, sorry...

show_edit_form.rjs
----------
page.replace @user.id, :partial => "edit_form"
This topic is locked and can not be replied to.