Loading pre-existing data with form_remote_tag

Is it possible to load pre-existing data into a form with
form_remote_tag? I am trying to load the data for a Person object into
the partial ‘name_form’ through a link in another partial ‘name_list’.
However, the ‘name_form’ partial renders without any data. Any idea how
I might get this to work?

(http://pastie.caboo.se/94816)

(_name_list.rhml)

<% for personname in @person.current_names %>
<%= link_to_function ‘personname.name’, :action => ‘update_name’, :id =>
@person_name, :onclick => “Element.show(‘update_name’)”%>
<% end %>

(person/show.rhtml)

<%= render :partial => ‘name_list’, :object => @person %>

<% form_remote_tag (:url => {:action => 'update_name', :id => @person_name}) do %> <%= render :partial => 'name_form' %> <%= submit_tag 'Update' %> <% end %>

(persons_controller.rb)

class PeopleController < ApplicationController
def update_name
id = params[:id]
@person_name = ClaimantName.find(params[:id])
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs