Changeset 29
- Timestamp:
- 04/17/06 15:06:05 (3 years ago)
- Files:
-
- trunk/plugin/acts_as_ferret/lib/acts_as_ferret.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugin/acts_as_ferret/lib/acts_as_ferret.rb
r26 r29 212 212 # This is called automatically when no index exists yet. 213 213 # 214 # TODO: this only works if every model class has it's 214 # TODO: the automatic index initialization only works if 215 # every model class has it's 215 216 # own index, otherwise the index will get populated only 216 217 # with instances from the first model loaded … … 253 254 logger.debug "id_array: #{id_array.inspect}" 254 255 begin 255 result = self.find(id_array) 256 logger.debug "Result id_array: #{id_array.inspect}, result: #{result}" 256 if self.superclass == ActiveRecord::Base 257 result = self.find(id_array) 258 else 259 # no direct subclass of Base --> STI 260 # TODO: AR will filter out hits from other classes for us, but this 261 # will lead to less results retrieved --> scoping of ferret query 262 # to self.class is still needed. 263 result = self.find(:all, :conditions => ["id in (?)",id_array]) 264 end 257 265 rescue 258 266 logger.debug "REBUILD YOUR INDEX! One of the id's didn't have an associated record: #{id_array}" 259 267 end 268 logger.debug "Result id_array: #{id_array.inspect}, result: #{result}" 260 269 return result 261 270 end
