Sha256: 92e622468940c502c0e4742a614601305fe7b5e7db0a768925f62c358629b9ad
Contents?: true
Size: 968 Bytes
Versions: 18
Compression:
Stored size: 968 Bytes
Contents
class Agilibox::SmallData::FiltersController < ::Agilibox::ApplicationController def create skip_authorization if respond_to?(:skip_authorization) skip_policy_scope if respond_to?(:skip_policy_scope) filters = ::Agilibox::SmallData::Filter.new(cookies) new_filters = params.fetch(:filters, {}).permit!.to_h filters.merge new_filters # Rewrite cookie with 1 year expiry cookies[:filters] = { :value => cookies[:filters], :expires => 1.year.from_now, :path => "/", } redirect_to back_url end private def back_url url = [ params[:form_url], request.referer, main_app.try(:root_path), "/", ].find(&:present?) # Delete page param base, query_string = url.split("?") query_string = query_string.to_s.split("&").delete_if { |p| p.include?("page=") }.join("&") query_string = "?#{query_string}" if query_string.present? base + query_string end end
Version data entries
18 entries across 18 versions & 1 rubygems