diff --git a/sunspot_rails/README.rdoc b/sunspot_rails/README.rdoc index 6edea446a..9ca6c81f3 100644 --- a/sunspot_rails/README.rdoc +++ b/sunspot_rails/README.rdoc @@ -248,6 +248,7 @@ http://outoftime.lighthouseapp.com/projects/20339-sunspot - Adam Salter (adam@codebright.net) - Brandon Keepers (brandon@opensoul.org) - Paul Canavese (paul@canavese.org) +- John Eberly (jeberly@elctech.com) == License diff --git a/sunspot_rails/dev_tasks/gemspec.rake b/sunspot_rails/dev_tasks/gemspec.rake index 915928e7a..115474812 100644 --- a/sunspot_rails/dev_tasks/gemspec.rake +++ b/sunspot_rails/dev_tasks/gemspec.rake @@ -16,7 +16,7 @@ running a Sunspot-compatible Solr instance for development and test environments, and automatically commit Solr index changes at the end of each Rails request. TEXT - s.authors = ['Mat Brown', 'Peer Allan', 'Michael Moen', 'Benjamin Krause', 'Adam Salter', 'Brandon Keepers', 'Paul Canavese'] + s.authors = ['Mat Brown', 'Peer Allan', 'Michael Moen', 'Benjamin Krause', 'Adam Salter', 'Brandon Keepers', 'Paul Canavese', 'John Eberly'] s.rubyforge_project = 'sunspot' s.files = FileList['[A-Z]*', '{lib,tasks,dev_tasks}/**/*', diff --git a/sunspot_rails/lib/sunspot/rails/adapters.rb b/sunspot_rails/lib/sunspot/rails/adapters.rb index 17b88d1a9..2ffb766bd 100644 --- a/sunspot_rails/lib/sunspot/rails/adapters.rb +++ b/sunspot_rails/lib/sunspot/rails/adapters.rb @@ -47,7 +47,9 @@ def select=(value) # ActiveRecord::Base:: ActiveRecord model # def load(id) - @clazz.send("find_by_#{@clazz.primary_key}", id.to_i, options_for_find) + @clazz.first(options_for_find.merge( + :conditions => { @clazz.primary_key => id.to_i} + )) end # @@ -62,7 +64,9 @@ def load(id) # Array:: Collection of ActiveRecord models # def load_all(ids) - @clazz.send("find_all_by_#{@clazz.primary_key}", 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 diff --git a/sunspot_rails/spec/model_spec.rb b/sunspot_rails/spec/model_spec.rb index c0ac3d585..515d0016b 100644 --- a/sunspot_rails/spec/model_spec.rb +++ b/sunspot_rails/spec/model_spec.rb @@ -116,7 +116,7 @@ end it 'should find ActiveRecord objects with an integer, not a string' do - Post.should_receive(:find_all_by_id).with([@post.id.to_i], anything).and_return([@post]) + Post.should_receive(:all).with(hash_including(:conditions => { "id" => [@post.id.to_i] })).and_return([@post]) Post.search do with :title, 'Test Post' end.results.should == [@post]