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 6, 2015
1 parent a9db4e4 commit 097bd57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/blacklight/solr/document.rb
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
12 changes: 12 additions & 0 deletions spec/lib/blacklight/solr/document_spec.rb
Expand Up @@ -47,6 +47,18 @@ def my_extension_method

end

describe "Primary key" do
before(:each) do
MockDocument.unique_key = 'my_unique_key'
end
after(:each) do
MockDocument.unique_key = 'id'
end
it "should be the same as the unique key" do
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 097bd57

Please sign in to comment.