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.
act_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