Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM::Controller: add hook to render metadata in the same context #193

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/iknow_view_models/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module IknowViewModels
VERSION = '3.7.3'
VERSION = '3.8.0'
end
5 changes: 5 additions & 0 deletions lib/view_model/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def prerender_viewmodel(viewmodel, status: nil, serialize_context: viewmodel.cla
ViewModel.serialize(viewmodel, json, serialize_context: serialize_context)
end

render_response_metadata(json, serialize_context: serialize_context)

if serialize_context && serialize_context.has_references?
json.references do
serialize_context.serialize_references(json)
Expand All @@ -34,6 +36,9 @@ def prerender_viewmodel(viewmodel, status: nil, serialize_context: viewmodel.cla
end
end

def render_response_metadata(json, serialize_context:)
end

# Render an arbitrarily nested tree of hashes and arrays with pre-rendered
# JSON string terminals. Useful for rendering cached views without parsing
# then re-serializing the cached JSON.
Expand Down