Re: Re: page.replace_html "#{var_containing_id_name}", :part


#1

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


#2

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 %>


#3

typo, sorry…

show_edit_form.rjs

page.replace @user.id, :partial => “edit_form”