Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个与acts_as_list集成的模型。但是,默认情况下,创建的新项目会添加到列表的末尾。是否有默认方式将新项目添加到开头?
谢谢!
尝试使用add_new_at配置选项:
add_new_at
acts_as_list scope: :todo, add_new_at: :top
您可以更改列表项的显示方式。颠倒顺序todo_items有效地实现了这一点。
todo_items
has_many :todo_items, :order => "position ASC"
否则,也许您可position以在after_create.
position
after_create