From 8bca2a3a0cddb9722dc80fbd65e419e3615f2a84 Mon Sep 17 00:00:00 2001 From: jk Date: Tue, 12 Sep 2006 20:44:03 +0000 Subject: [PATCH] r1260@monsoon: jk | 2006-09-12 22:43:49 +0200 work with non-int-primarey keys (untested yet) git-svn-id: svn://projects.jkraemer.net/acts_as_ferret/trunk/plugin/acts_as_ferret@103 7326d000-0a0e-0410-9cad-a9b28e7838dc --- lib/class_methods.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/class_methods.rb b/lib/class_methods.rb index 290203a..2ff8aae 100644 --- a/lib/class_methods.rb +++ b/lib/class_methods.rb @@ -270,7 +270,7 @@ module FerretMixin # order results as they were found by ferret, unless an AR :order # option was given unless find_options[:order] - result.sort! { |a, b| id_positions[a.id] <=> id_positions[b.id] } + result.sort! { |a, b| id_positions[a.id.to_s] <=> id_positions[b.id.to_s] } end logger.debug "Query: #{q}\nResult id_array: #{id_array.inspect},\nresult: #{result}" @@ -377,7 +377,7 @@ module FerretMixin doc = index[hit] model = configuration[:store_class_name] ? doc[:class_name] : self.name if block_given? - yield model, doc[:id].to_i, score + yield model, doc[:id], score else result << { :model => model, :id => doc[:id], :score => score } end @@ -413,7 +413,7 @@ module FerretMixin total_hits = searcher.search_each (query, options) do |hit, score| doc = searcher[hit] if block_given? - yield doc[:class_name], doc[:id].to_i, score + yield doc[:class_name], doc[:id], score else result << { :model => doc[:class_name], :id => doc[:id], :score => score } end -- 2.11.4.GIT