You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if it is an issue with acts_as_list or just my code but i ran into the problem that if i have a validates :uniqueness on the position column, an error would come up when creating a new list_item saying that the position was not unique. I removed the validation and my app works fine now but thought it might be worth mentioning.
The text was updated successfully, but these errors were encountered:
I had a similar problem -- my position column is marked as unique in the database, and the "move_lower" implementation causes unique constraint errors.
I was able to fix this with the following monkey patch (this doesn't fix all methods, e.g. "move_to_bottom" / "move_to_top" are still broken):
moduleActiveRecord::Acts::List::InstanceMethods# See acts_as_list/active_record/acts/list.rbdefmove_lowerreturnunlessother=lower_itemswap_position_withotherenddefmove_higherreturnunlessother=higher_itemswap_position_withotherenddefswap_position_withother_itemacts_as_list_class.transactiondoother_position=other_item.send(position_column)other_item.update_attributes!position_column=> -1self_position=send(position_column)update_attributes!position_column=>other_positionother_item.update_attributes!position_column=>self_positionendendend
I don't know if it is an issue with acts_as_list or just my code but i ran into the problem that if i have a validates :uniqueness on the position column, an error would come up when creating a new list_item saying that the position was not unique. I removed the validation and my app works fine now but thought it might be worth mentioning.
The text was updated successfully, but these errors were encountered: