Closed molfar closed 5 years ago
Hi @molfar, try remove_from_list
to remove an item from the list :)
@brendon ok, but is there any explicit way? I update the record with params coming from user form.
item = Item.find params[:id]
item.update params[:item] # position param included here
When user set position to blank value, it is expected item to be removed from list. Or we should manually check if params[:position] was blank, then remove_from_list?
Hi @molfar, so far as I know, the best way to do this is to have a column called 'in_list' as a boolean, then use acts_as_list scope: [:in_list]
. Then you can add and remove items via setting in_list
to true
or false
.
I have ordered set of records:
When I set position to nil value
Item.find(2).update position: nil
Then I get broken order:But expected result is: