lib/zermelo/associations/index.rb in zermelo-1.1.0 vs lib/zermelo/associations/index.rb in zermelo-1.2.0
- old
+ new
@@ -1,7 +1,9 @@
# NB index instances are all internal to zermelo, not user-accessible
+require 'zermelo/records/key'
+
module Zermelo
module Associations
class Index
def initialize(parent_klass, name)
@@ -27,10 +29,10 @@
@backend.add(indexer, id)
end
def move_id(id, value_from, indexer_to, value_to)
return unless indexer = key(value_from)
- @backend.move(indexer, id, indexer_to.key(value_to))
+ @backend.move(indexer, id, indexer_to.key(value_to), id)
end
def key(value)
index_keys = @backend.index_keys(@attribute_type, value)
raise "Can't index '#{@value}' (#{@attribute_type}" if index_keys.nil?
\ No newline at end of file