I have a field called sequence
in my model. I want to reset all sequences of particular record set and update all sequences one by one 1
. But while using reset_counter
I'm getting has no association called 'sequence'
. Here is my code block
ids = [1,2,4,6,7]
Group.reset_counters(ids, "sequence")
Group.increment_counter(sequence, ids)
Is it any way to update given ids sequence by 1 (each id sequence should be updated by 1 to the previous id)?
PS: update_attribute
is taking time for updating individual records. so i want to update records in bulk.