Skip to content

Commit

Permalink
Remove code supporting Rails 4.0 and earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Oct 19, 2015
1 parent d0bf0d0 commit 0a1c026
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 28 deletions.
6 changes: 0 additions & 6 deletions app/helpers/blacklight/url_helper_behavior.rb
Expand Up @@ -287,10 +287,4 @@ def remove_facet_params(field, item, source_params=params)
def bookmarks_export_url(format, params = {})
bookmarks_url(params.merge(format: format, encrypted_user_id: encrypt_user_id(current_or_guest_user.id) ))
end

if ::Rails.version < "4.0"
def asset_url *args
"#{request.protocol}#{request.host_with_port}#{asset_path(*args)}"
end
end
end
25 changes: 8 additions & 17 deletions lib/blacklight/configuration.rb
Expand Up @@ -304,26 +304,17 @@ def add_field_configuration_to_solr_request! *fields
# Provide a 'deep copy' of Blacklight::Configuration that can be modifyed without affecting
# the original Blacklight::Configuration instance.
#
# The Rails 3.x version only copies hashes, and ignores arrays and similar structures
if ::Rails.version < "4.0"
def deep_copy
Marshal.load(Marshal.dump(self))
end
alias_method :inheritable_copy, :deep_copy
else
##
# Rails 4.x provides `#deep_dup`, but it aggressively `#dup`'s class names
# too. These model names should not be `#dup`'ed or we might break ActiveModel::Naming.
def deep_copy
deep_dup.tap do |copy|
%w(repository_class response_model document_model document_presenter_class search_builder_class facet_paginator_class).each do |klass|
# Don't copy if nil, so as not to prematurely autoload default classes
copy.send("#{klass}=", send(klass)) unless fetch(klass.to_sym, nil).nil?
end
# Rails 4.x provides `#deep_dup`, but it aggressively `#dup`'s class names
# too. These model names should not be `#dup`'ed or we might break ActiveModel::Naming.
def deep_copy
deep_dup.tap do |copy|
%w(repository_class response_model document_model document_presenter_class search_builder_class facet_paginator_class).each do |klass|
# Don't copy if nil, so as not to prematurely autoload default classes
copy.send("#{klass}=", send(klass)) unless fetch(klass.to_sym, nil).nil?
end
end
alias_method :inheritable_copy, :deep_copy
end
alias_method :inheritable_copy, :deep_copy

##
# Get a view configuration for the given view type
Expand Down
6 changes: 1 addition & 5 deletions lib/blacklight/facet_paginator.rb
Expand Up @@ -17,12 +17,8 @@ class FacetPaginator
{ sort: :'facet.sort', page: :'facet.page', prefix: :'facet.prefix' }
end

if Rails.version < "4.1"
self.request_keys = { sort: :'facet.sort', page: :'facet.page', prefix: :'facet.prefix' }
end

attr_reader :offset, :limit, :sort, :prefix

# all_facet_values is a list of facet value objects returned by solr,
# asking solr for n+1 facet values.
# options:
Expand Down

0 comments on commit 0a1c026

Please sign in to comment.