On Sat, Oct 29, 2011 at 05:49, Jedrin <[email protected]> wrote: > I would like to consider if I can load the form in pieces via AJAX.
The big question is, can you group the elements so that they are from a simpler batch of database queries? It sounds like many of the form elements, if not all of them, would be coming from the same rather complex database query. If so, then I would recommend you take these elements all together in one AJAX call, so that the database query is only done once. Very simple example: Suppose your form has a customer's name, contact information, and order history, including the details of each order (how many of what at what price each, total, tax, shipping, grand total), and the master total of all orders. The name and order *IDs* could come from two very simple queries done in the controller. Then you could have the form, upon loading in the browser, fire off AJAX queries, one for each order to get the details. (Better yet, do it not on load, but on user request, if it's something they don't necessarily always need.) Upon receiving each of these you could fill in the sections, and add to the master total. Thus the order detail retrieval would be parallelized. This probably wouldn't really be worth it, but if your situation is much hairier, something analogous may be applicable. Alternately, think about breaking up your form. -Dave -- LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages. Where: Northern Virginia, Washington DC (near Orange Line), and remote work. See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence). Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

