lib/sidekiq/web/helpers.rb in sidekiq-6.0.7 vs lib/sidekiq/web/helpers.rb in sidekiq-6.1.0
- old
+ new
@@ -199,16 +199,13 @@
SAFE_QPARAMS = %w[page poll direction]
# Merge options with current params, filter safe params, and stringify to query string
def qparams(options)
- # stringify
- options.keys.each do |key|
- options[key.to_s] = options.delete(key)
- end
+ stringified_options = options.transform_keys(&:to_s)
- to_query_string(params.merge(options))
+ to_query_string(params.merge(stringified_options))
end
def to_query_string(params)
params.map { |key, value|
SAFE_QPARAMS.include?(key) ? "#{key}=#{CGI.escape(value.to_s)}" : next
@@ -231,10 +228,10 @@
"Illegal job arguments: #{h args.inspect}"
end
end
def csrf_tag
- "<input type='hidden' name='authenticity_token' value='#{session[:csrf]}'/>"
+ "<input type='hidden' name='authenticity_token' value='#{env[:csrf_token]}'/>"
end
def to_display(arg)
arg.inspect
rescue