Skip to content

Commit 992de8a

Browse files
committed
Rails 7.1 Incompatibility: Payload exclude locals
Inspired by @abrom in #203: "I've been doing some digging and have found the cause of the SystemStackError being raised when trying to using meta_request with Rails 7.1.x In short it comes down to a change in the instrumentation mechanism to include locals: rails/rails@b451ff0#diff-c92c886291bac7b41bab2a3a884a476ff8edfe2827da7db5ee0bf78c9ad8a17fR250 The problem being that meta_request tries to serialise the render payload to JSON, however the template property of the ActionView objects (if passed through the locals when rendering a template) has cyclic child dependencies (the routes) which can not be serialised. The simple fix would be to exclude that key (locals) in the serialisation to revert the behaviour to pre-Rails 7.1.x as such: payload.except(:locals)"
1 parent dedbe2a commit 992de8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

meta_request/lib/meta_request/event.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def sanitize_hash(payload)
6161
payload[:key] = ActiveSupport::Cache::Store.new.send(:normalize_key, payload[:key])
6262
end
6363

64-
payload
64+
payload.except(:locals)
6565
end
6666

6767
def not_encodable?(value)

0 commit comments

Comments
 (0)