Skip to content

Commit

Permalink
SolrDocument.primary_key should be the same as Solr's unique key.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Feb 3, 2015
1 parent a9db4e4 commit d680ec7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/blacklight/solr/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ module ClassMethods
def unique_key
@unique_key ||= 'id'
end

def primary_key
'id'
unique_key
end

def base_class
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/blacklight/solr/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def my_extension_method

end

describe "Primary key" do
it "should be the same as the unique key" do
MockDocument.unique_key = double
expect(MockDocument.primary_key).to eq MockDocument.unique_key
end
end

describe "#to_param" do
it "should be a string" do
@document = MockDocument.new :id => 1234
Expand Down

0 comments on commit d680ec7

Please sign in to comment.