port5432
port5432

Reputation: 6381

Sequence numbers in Rails

I have a Rails app that has a seq (sequence number field). I'd like it to be an invisible field, and for it to auto-increment, but be separate from the id.

On the index page, I'd like to be able to drag-and-drop the rows to re-sequence them, and the sequence should then go from 1 to the highest row.

What's the easy way to do this or can anyone suggest a tutorial I could follow?

Upvotes: 1

Views: 1477

Answers (1)

Rodrigo_at_Ximera
Rodrigo_at_Ximera

Reputation: 548

If I'm understanding correctly, what you want is for your records to be "sortable". Take a look at these plugins: Active Record Sortables

Upvotes: 2

Related Questions