Hi guys,
I am stuck with something, I was hoping someone could point me in the
right direction…
In short:
- I need to render a bunch of partials (corresponding to models)
- I need to do some DOM logic on them (check if they already exist in
the page, insert them at the right place in the DOM hierarchy, etc) - I need to do the above first following a standard call, and
subsequently after AJAX ones.
Right now I have two different methods for each type of call:
- standard: I render the partials inline in the view - it seems fine
and easy - AJAX: I am trying to use render :update, but the DOM logic becomes
really difficult to write (with a lot of page <<
‘javascript_and_prototype_stuff’)
The fact I can’t get the same method to work in both cases probably
mean I am missing something. Besides, in the AJAX case, the code
doesn’t look very good at all (mixing js logic and Ruby), and it’s a
lot more complicated than if I were to write plain javascript.
Is there a recommended/standard way to do this?
And as a side question: if I go for a pure javascript implementation,
I am going to miss the convenient render :partial method, isn’t it? Or
is there a way to access it from javascript when it’s rendered?
Thanks a lot,
Peter