# Moving positions between lists with ajax

**URL:** <https://www.ruby-forum.com/t/moving-positions-between-lists-with-ajax/138518>\
**Category:** Rails\
**Created:** [May 23, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/moving-positions-between-lists-with-ajax/138518 "2008-05-23T22:28:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@anka](https://www.ruby-forum.com/u/anka)\
**Post date:** [May 23, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/moving-positions-between-lists-with-ajax/138518/1 "2008-05-23T22:28:32Z")

</div>

I want to put two lists on one page: list of users (not belong to group)  
and list of group users (users which are belong to group).  
I want to move users between this two lists with ajax, but save changes  
at the end - when all users which I want will be moved.  
Moving with ajax is easy but it works only with one step. Every time I  
have to take list: @users and @group\_users from database so I lose  
change from last step.  
I’m not sure it’s clear…  
But my question is: can I remember object (collection) between actions  
(not using cookies and session)?  
Or mabye someone knows, where can I find some example how to do lists as  
I described?  
Thanks for help.

---

<div class="post-metadata">

**Author:** ![anka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@anka](https://www.ruby-forum.com/u/anka)\
**Post date:** [May 24, 2008, 12:38am UTC](https://www.ruby-forum.com/t/moving-positions-between-lists-with-ajax/138518/2 "2008-05-24T00:38:33Z")

</div>

Have a look at the code here:

> **[\#75 Complex Forms Part 3 - RailsCasts](http://railscasts.com/episodes/75-complex-forms-part-3)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

It’s not _exactly_ what you’re after, but I suspect you can use the same  
psuedo-attribute/mass-assignment approach to create a form that will let  
your user build up a list of people all in client-side script & submit  
them all in one batch at the end.

You may want to actually watch railscasts 73, 74 & 75 before trying to  
understand that code, just for context. I found that code fairly  
mind-blowing, myself (tho I’m a newbie).

HTH,

-Roy
