Rearrangeable ordered list with Ruby on Rails -


I want to apply a favorite favorite list. Take a playlist for this example:

  song a song de song b songs c   

The order of the songs should be saved and the user should be The order is rearranged and able to insert new elements into an arbitrary point in the list.

My idea is to use a field "position" and reset it for all the elements in the list, when the list will be saved. I think what Java Hibernate does.

Another idea is to use position numbers with 1000 digits, to say that there is still room for modifications:

  song 1 1000 song D 2000 Song B 3000 song C4000   

The location will be inserted between A and D with the C 1500:

  Song A 1000 Song C 1500 Song D 2000 Song B 3000   

Any better ideas?

Why not use it?

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -