I see that we can block auto-updating positions in a list only for class to whom call the method acts_as_list_no_update
But what if I need to disable for parent or child classes inside a block for example:
class TodoList < ActiveRecord::Base
has_many :todo_items, -> { order(position: :asc) }
end
class TodoItem < ActiveRecord::Base
belongs_to :todo_list
has_many :todo_attachments, -> { order(position: :asc) }
acts_as_list scope: :todo_list
end
class TodoAttachment < ActiveRecord::Base
belongs_to :todo_list
acts_as_list scope: :todo_item
end
TodoItem.acts_as_list_no_update([TodoAttachment]) do
TodoItem.find(10).update(position: 2)
TodoAttachment.find(10).update(position: 1)
TodoAttachment.find(11).update(position: 2)
end
These changes under allow to pass additional classes as an argument and don't update positions for records of the passed classes inside of the block where there might be interactions with them.
I see that we can block auto-updating positions in a list only for class to whom call the method
acts_as_list_no_update
But what if I need to disable for parent or child classes inside a block for example:These changes under allow to pass additional classes as an argument and don't update positions for records of the passed classes inside of the block where there might be interactions with them.
Thanks!