use this function to repair / build your lists.
@example [Usage]
MyModel.repair_list # repairs the list, given that lists are not scoped MyModel.repair_list(:user_id => 1) # fixes the list for user 1, given that the scope is [:user_id]
@param scope [Hash]
@api public
# File lib/dm-is-list/is/list.rb, line 316 def repair_list(scope = {}) return false unless scope.keys.all?{ |s| list_options[:scope].include?(s) || s == :order } retval = true all({ :order => [ :position.asc ] | default_order }.merge(scope)).each_with_index do |item, index| retval &= item.update(:position => index.succ) end retval end
Generated with the Darkfish Rdoc Generator 2.