Skip to content

Commit 51172f0

Browse files
committed
Merge pull request #1083 from projectblacklight/release-5.9-backports
Release 5.9 backports
2 parents 884d23a + 56c72cf commit 51172f0

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

lib/blacklight/configuration.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,16 @@ def deep_copy
252252
end
253253
alias_method :inheritable_copy, :deep_copy
254254
else
255-
alias_method :deep_copy, :deep_dup
256-
alias_method :inheritable_copy, :deep_dup
255+
##
256+
# Rails 4.x provides `#deep_dup`, but it aggressively `#dup`'s class names
257+
# too. These model names should not be `#dup`'ed or we might break ActiveModel::Naming.
258+
def deep_copy
259+
deep_dup.tap do |copy|
260+
copy.solr_response_model = self.solr_response_model
261+
copy.solr_document_model = self.solr_document_model
262+
end
263+
end
264+
alias_method :inheritable_copy, :deep_copy
257265
end
258266

259267
##

lib/blacklight/routes.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ def bookmarks(_)
6666
get "bookmarks/sms", :as => "sms_bookmarks"
6767
post "bookmarks/sms"
6868
get "bookmarks/citation", :as => "citation_bookmarks"
69-
resources :bookmarks
69+
70+
args = {}
71+
args[:constraints] = options[:constraints] if options[:constraints]
72+
resources :bookmarks, args
7073
end
7174
end
7275

spec/lib/blacklight/configuration_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@
8484
expect(@config.facet_fields).to_not include(@mock_facet)
8585
end
8686

87+
it "should not dup solr_response_model or solr_document_model" do
88+
@config.solr_response_model = Blacklight::SolrResponse
89+
@config.solr_document_model = SolrDocument
90+
91+
config_copy = @config.inheritable_copy
92+
93+
expect(config_copy.solr_response_model).to eq Blacklight::SolrResponse
94+
expect(config_copy.solr_document_model).to eq SolrDocument
95+
end
96+
8797
it "should provide cloned copies of mutable data structures" do
8898
@config.a = { value: 1 }
8999
@config.b = [1,2,3]

0 commit comments

Comments
 (0)