Skip to content

Commit 27a1fb4

Browse files
author
Sergei Maximov
committed
Add a comment stating that the proc is evaluated in the controller context
1 parent 3f98732 commit 27a1fb4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/jsonapi/rails/renderer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def self.render(errors, options)
2828
# @api private
2929
def rails_renderer(renderer)
3030
proc do |json, options|
31+
# Renderer proc is evaluated in the controller context, so it
32+
# has access to the request object.
3133
reverse_mapping = request.env[ActionController::REVERSE_MAPPING_KEY]
3234
options = options.merge(_reverse_mapping: reverse_mapping)
3335
json = renderer.render(json, options) unless json.is_a?(String)

0 commit comments

Comments
 (0)