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 17, 2015
1 parent 70820e0 commit a39b5f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
6 changes: 0 additions & 6 deletions app/helpers/blacklight/url_helper_behavior.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
4 changes: 0 additions & 4 deletions lib/blacklight/facet_paginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class FacetPaginator
{ sort: :'facet.sort', page: :'facet.page' }
end

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

attr_reader :offset, :limit, :sort

# all_facet_values is a list of facet value objects returned by solr,
Expand Down

0 comments on commit a39b5f7

Please sign in to comment.