Sha256: 9a27b6b7dcb761bf108f55d68192e4b71467374d0d5495ab1987e62b0228a94e
Contents?: true
Size: 998 Bytes
Versions: 2
Compression:
Stored size: 998 Bytes
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] 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
2 entries across 2 versions & 1 rubygems