Method: MethodOrProcHelper#render_in_context
- Defined in:
- lib/active_admin/view_helpers/method_or_proc_helper.rb
permalink #render_in_context(context, obj, *args) ⇒ Object
This method is different from the others in that it calls ‘instance_exec` on the receiver, passing it the proc. This evaluates the proc in the context of the receiver, thus changing what `self` means inside the proc.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/active_admin/view_helpers/method_or_proc_helper.rb', line 86 def render_in_context(context, obj, *args) context = self if context.nil? # default to `self` only when nil case obj when Proc context.instance_exec *args, &obj when Symbol context.public_send obj, *args else obj end end |