lib/sunspot/rails/adapters.rb in sunspot_rails-1.0.1 vs lib/sunspot/rails/adapters.rb in sunspot_rails-1.0.2
- old
+ new
@@ -45,11 +45,13 @@
# ==== Returns
#
# ActiveRecord::Base:: ActiveRecord model
#
def load(id)
- @clazz.find_by_id(id.to_i, options_for_find)
+ @clazz.first(options_for_find.merge(
+ :conditions => { @clazz.primary_key => id.to_i}
+ ))
end
#
# Get a collection of ActiveRecord instances out of the database by ID
#
@@ -60,10 +62,12 @@
# ==== Returns
#
# Array:: Collection of ActiveRecord models
#
def load_all(ids)
- @clazz.find_all_by_id(ids.map { |id| id.to_i }, options_for_find)
+ @clazz.all(options_for_find.merge(
+ :conditions => { @clazz.primary_key => ids.map { |id| id.to_i }}
+ ))
end
private
def options_for_find