Make sure that locals is always initialized in render_association. If it is not, the call to Hash#merge will fail.

This commit is contained in:
Brian Meeker 2012-04-07 16:59:43 -04:00
parent 5fa318a7f6
commit e43a03919c
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ module Cocoon
# :nodoc:
def render_association(association, f, new_object, render_options={}, custom_partial=nil)
partial = setup_partial(custom_partial, association)
locals = render_options.delete(:locals)
locals = render_options.delete(:locals) || {}
method_name = f.respond_to?(:semantic_fields_for) ? :semantic_fields_for : (f.respond_to?(:simple_fields_for) ? :simple_fields_for : :fields_for)
f.send(method_name, association, new_object, {:child_index => "new_#{association}"}.merge(render_options)) do |builder|
partial_options = {:f => builder, :dynamic => true}.merge(locals)