Greg Freemyer
2006-Mar-15 01:32 UTC
[Rails] Ajax_generator as a component for master/detail use?
I''m experimenting with the Ajax Generator for the first time and I''m trying to setup a master/detail edit page. My goal is to display both the Master info and the detail records on a single page. And allow detail records to be created/edited/deleted on the fly. Not sure its possible, but that''s what I''m trying to do. === Details I have an existing master table of clients. I''ve just created a detail table of todos. (Plural of todo). I''ve used the "script/generate ajax_scaffold todo" to create a basic todos MVC set. Note the plural todos. For some reason the ajax generator created files with the plural name. I now want to edit my master table''s edit view to have it incorporate the detail records. As a newbie I''m guessing that I should add <div id="todo_list"> <%= render_component :controller => "todos" %> </div> This sort of works. A blank detail record area is being rendered at the bottom of the master edit screen and when I click on "new" ajax pops up a new blank detail record. Even better if I have a detail record in the database it is rendered properly. (Rendered on all master edit pages, but this is a very good start.) The first trouble is that when I try to create a new detail record the master edit form goes away and the master show page is displayed. The detail record itself is not being saved. Am I headed in the right direction, and if so what do I need to do? Thanks Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century