From e2a66168bfa38d6536944680815d417538ef7000 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 29 Mar 2012 16:30:30 -0300 Subject: [PATCH] Make partial! consistent with render signature --- lib/jbuilder_template.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/jbuilder_template.rb b/lib/jbuilder_template.rb index 17287f58..d9e1e905 100644 --- a/lib/jbuilder_template.rb +++ b/lib/jbuilder_template.rb @@ -7,11 +7,18 @@ def initialize(context) @context = context super() end - - def partial!(partial_name, options = {}) - @context.render(partial_name, options.merge(:json => self)) + + def partial!(options, locals = {}) + case options + when Hash + options[:locals] ||= {} + options[:locals].merge!(:json => self) + @context.render(options) + else + @context.render(options, locals.merge(:json => self)) + end end - + private def _new_instance __class__.new(@context)