diff --git a/lib/jbuilder/jbuilder_template.rb b/lib/jbuilder/jbuilder_template.rb index 1cf8cbe..36d525c 100644 --- a/lib/jbuilder/jbuilder_template.rb +++ b/lib/jbuilder/jbuilder_template.rb @@ -183,7 +183,7 @@ def _is_active_model?(object) def _set_inline_partial(name, object, options) value = if object.nil? - [] + nil elsif _is_collection?(object) _scope{ _render_partial_with_options options.merge(collection: object) } else diff --git a/test/jbuilder_template_test.rb b/test/jbuilder_template_test.rb index 7ec99d6..3956631 100644 --- a/test/jbuilder_template_test.rb +++ b/test/jbuilder_template_test.rb @@ -217,14 +217,6 @@ def assert_collection_rendered(result, context = nil) assert_collection_rendered result, "posts" end - test "render as empty array if partials as a nil value" do - result = jbuild <<-JBUILDER - json.posts nil, partial: "blog_post", as: :blog_post - JBUILDER - - assert_equal [], result["posts"] - end - test "cache an empty block" do undef_context_methods :fragment_name_with_digest, :cache_fragment_name