File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff 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 ##
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 ]
You can’t perform that action at this time.
0 commit comments