Skip to content

Commit

Permalink
Add John Eberly to contribs, refactor patch a bit
Browse files Browse the repository at this point in the history
[sunspot#83 state:resolved]
  • Loading branch information
Mat Brown committed Mar 10, 2010
1 parent 8c19eed commit 0dd4545
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions sunspot_rails/README.rdoc
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion sunspot_rails/dev_tasks/gemspec.rake
Expand Up @@ -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}/**/*',
Expand Down
8 changes: 6 additions & 2 deletions sunspot_rails/lib/sunspot/rails/adapters.rb
Expand Up @@ -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

#
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sunspot_rails/spec/model_spec.rb
Expand Up @@ -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]
Expand Down

0 comments on commit 0dd4545

Please sign in to comment.