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)