module Sequel::Plugins::List

def self.configure(model, opts = {})

Also, modify the model dataset's order to order by the position and scope fields.
accepts a model instance and returns a dataset representing the list.
The :scope option can be a symbol, array of symbols, or a proc that
using the :field and :scope options, respectively.
Set the +position_field+ and +scope_proc+ attributes for the model,
def self.configure(model, opts = {})
  model.position_field = opts[:field] || :position
  model.dataset = model.dataset.order_prepend(model.position_field)
  
  model.scope_proc = case scope = opts[:scope]
  when Symbol
    model.dataset = model.dataset.order_prepend(scope)
    proc{|obj| obj.model.filter(scope=>obj.send(scope))}
  when Array
    model.dataset = model.dataset.order_prepend(*scope)
    proc{|obj| obj.model.filter(scope.map{|s| [s, obj.send(s)]})}
  else
    scope
  end
end