Xavier Noria wrote: > On Thu, Jun 11, 2009 at 7:59 PM, Tyler > Knappe<[email protected]> wrote: > >> for j in 0..6 do >> >> ========== >> >> When the function is called, it only replaces a single element out of >> the loop (the first). Is there a way to render all elements? It sounds >> like RJS is the way to do this (http://www.ruby-forum.com/topic/135158) >> but I still don't see how. > > It is not a good pratice to use render :update like that. When the RJS > is more than a one-liner, say, it is more clean to extract that to its > own RJS template. Because RJS belongs to the V in MVC. > > On the other hand the idea of the loop + calls to page...something is > correct. In your example the ID of the element is always the same > though. Knowing this, you could for example simplify the code like > eliminating the conditional to get a wrong but working version, and > after that add all the logic.
Right, I understand the MVC logic. However, even removing the logic from the loop only renders a single time; the first element. If I swap how the loop is performed to loop over the :update then I get an error about attempting more than one render per call. The same is also true of redirects. Is there a better way of doing this, or will RJS fix the problem? Can it perform more than one render? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

