Sha256: 8f3762727b869e9099070bf4cf9854fb9a09d23c8e38fb68464799f33701bece
Contents?: true
Size: 1.02 KB
Versions: 12
Compression:
Stored size: 1.02 KB
Contents
# Returns a lambda that you can use with a before_filter in your # CatalogController to catch and redirect query params using the old # style, used prior to blacklight_advanced_search 5.0. # # This can be used to keep any old bookmarked URLs still working. # # before_filter BlacklightAdvancedSearch::RedirectLegacyParamsFilter, :only => :index # module BlacklightAdvancedSearch class RedirectLegacyParamsFilter def self.before(controller) params = controller.send(:params) if params[:f_inclusive] && params[:f_inclusive].respond_to?(:each_pair) legacy_converted = false params[:f_inclusive].each_pair do |field, value| if value.kind_of? Hash # old style! convert! legacy_converted = true params[:f_inclusive][field] = value.keys end end if legacy_converted controller.send(:redirect_to, params, :status => :moved_permanently) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems