I have used nested scaffolds by using a little bit different way other
than R.White showed in his article...
I am now trying to migrate my compony's Personel Management app from
Delphi (Client/Server) to a web based one - ofcourse to Ruby on
Rails... And I am using ajax scaffold with much pleasure...
Let me explain what I did:
First, I did not create a seperate controller like person_pets...
I have just 2 controllers: one for Employee and one for a
An_Employee_Related_Child_Table.
Then, I have included the below lines of code to _form.rhtml in
Employee view...
<% employee_child_table_params = params.merge(:scaffold_id =>
[@options[:scaffold_id], @options[:id],
"employee_child_table(s)"].join("-")) %>
<div id="<%= employee_child_table_params[:scaffold_id] %>"
class="ajax-scaffold">
<div id="<%= scaffold_content_id(employee_child_table_params) %>">
<%= render_component :controller => '/employee_child_table_controller',
:action => 'component', :params => employee_child_table_params %>
</div>
</div>
And it worked like a charm....
I have not passed parent_id to child_controller since I am using a
session variable to hold it...
I know it is not an "invention", but I wanted to share my experiment
with all of you..
Happy coding...