File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
meta_request/lib/meta_request Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def json_encodable(payload)
4040 transform_hash ( payload , deep : true ) do |hash , key , value |
4141 if value . class . to_s == 'ActionDispatch::Http::Headers'
4242 value = value . to_h . select { |k , _ | k . upcase == k }
43- elsif defined? ( ActiveRecord ) && value . is_a? ( ActiveRecord :: ConnectionAdapters :: AbstractAdapter )
43+ elsif not_encodable? ( value )
4444 value = NOT_JSON_ENCODABLE
4545 end
4646
@@ -54,6 +54,11 @@ def json_encodable(payload)
5454 end . with_indifferent_access
5555 end
5656
57+ def not_encodable? ( value )
58+ ( defined? ( ActiveRecord ) && value . is_a? ( ActiveRecord ::ConnectionAdapters ::AbstractAdapter ) ) ||
59+ ( defined? ( ActionDispatch ) && ( value . is_a? ( ActionDispatch ::Request ) ) || value . is_a? ( ActionDispatch ::Response ) )
60+ end
61+
5762 # https://gist.github.com/dbenhur/1070399
5863 def transform_hash ( original , options = { } , &block )
5964 options [ :safe_descent ] ||= { }
You can’t perform that action at this time.
0 commit comments