I have a model integrated with acts_as_list. However, by default new items created get added to the end of the list. Is there a default way to add new items to the beginning?
Thanks!
I have a model integrated with acts_as_list. However, by default new items created get added to the end of the list. Is there a default way to add new items to the beginning?
Thanks!
Try using the add_new_at
configuration option:
acts_as_list scope: :todo, add_new_at: :top
You can change the way the list items are displayed to begin with. Reversing the order of todo_items
effectively accomplishes that.
has_many :todo_items, :order => "position ASC"
Otherwise, perhaps you can set the position
column on the items manually in an after_create
.
© 2022 - 2024 — McMap. All rights reserved.