Skip to content

Commit

Permalink
DeprecatedConstantProxy doesn't work with classes; do manual deprecat…
Browse files Browse the repository at this point in the history
…ions instead
  • Loading branch information
cjcolvar committed Nov 9, 2015
1 parent 00b17b6 commit b045407
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/blacklight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module Blacklight
autoload :Routes, 'blacklight/routes'
autoload :Solr, 'blacklight/solr'

SolrRepository = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::SolrRepository', 'Blacklight::Solr::Repository')
SolrResponse = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::SolrResponse', 'Blacklight::Solr::Response')
autoload :SolrHelper, 'blacklight/solr_helper'

autoload :AbstractRepository, 'blacklight/abstract_repository'
Expand All @@ -25,6 +23,20 @@ class << self
attr_accessor :solr, :solr_config
end

# For deprecating SolrRepository and SolrResponse
def self.const_missing(const_name)
case const_name
when :SolrRepository
Deprecation.warn(:SolrRepository, 'Blacklight::SolrRepository is deprecated; use Blacklight::Solr::Repository instead')
Solr::Repository
when :SolrResponse
Deprecation.warn(:SolrResponse, 'Blacklight::SolrResponse is deprecated; use Blacklight::Solr::Response instead')
Solr::Response
else
super
end
end

# Secret key used to share session information with
# other services (e.g. refworks callback urls)
mattr_accessor :secret_key
Expand Down

0 comments on commit b045407

Please sign in to comment.