Hypothetical: I want 32 sections with 4 slots. Each slot can hold a person from a drag list.
What is the best way to maintain your position (and return back to the user) by keeping spaces or “slots” in the right place?
Now I have something like a script, but when I save it, I just send it data-idas an array, so it keeps their order, but does not take into account empty spaces ... and, of course, my method of reading the list returns the array back. i.e. If I have, when creating: Tim, empty, Bob, my controller saves empty ['Tim', 'Bob'], and when the user reboots, they see: Tim, Bob, empty, empty
So, this is a question of two parties:
1) How to save a list of users , including spaces And what is the best way to do this with rails / mongoid? Again, I currently know how to save, I just don't know if it is better to use an array / object or what ...
2) How to rebuild / read / load the list?
Fiddle : Imagine this is another 31 sections to fill ... this is just one section.
EDIT
If I used a gem, for example acts_as_list, would it be bad (since each user will have 128 entries) to have a row per user element? In my opinion, this will make the mango collection have too many documents, but I also have a poor understanding of mongodb.
user_id,
pick_id,
position
instead
user_id,
picks [
"pick_id_1234",
"pick_id_1235",
"pick_id_1236"
]