lib/jbuilder/jbuilder_template.rb in jbuilder-2.2.8 vs lib/jbuilder/jbuilder_template.rb in jbuilder-2.2.9

- old
+ new

@@ -15,14 +15,19 @@ end def partial!(name_or_options, locals = {}) case name_or_options when ::Hash - # partial! partial: 'name', locals: { foo: 'bar' } + # partial! partial: 'name', foo: 'bar' options = name_or_options else + # partial! 'name', locals: {foo: 'bar'} + if locals.one? && (locals.keys.first == :locals) + options = locals.merge(partial: name_or_options) + else + options = { partial: name_or_options, locals: locals } + end # partial! 'name', foo: 'bar' - options = { partial: name_or_options, locals: locals } as = locals.delete(:as) options[:as] = as if as.present? options[:collection] = locals[:collection] if locals.key?(:collection) end