Permalink
Browse files

Make sure a namespaced <%= render form %> still renders the _form par…

…tial [#4784 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 73df480 commit 96f5e59a26329aa972b8061a818410b0b378f306 @DefV DefV committed with josevalim Jun 7, 2010
@@ -316,7 +316,7 @@ def partial_path(object = @object)
object.class.model_name.partial_path.dup.tap do |partial|
path = @view.controller_path
- partial.insert(0, "#{File.dirname(path)}/") if path.include?(?/)
+ partial.insert(0, "#{File.dirname(path)}/") if partial.include?(?/) && path.include?(?/)
end
end
end
@@ -7,6 +7,10 @@ class GamesController < ActionController::Base
# :ported:
def hello_world
end
+
+ def nested_partial_with_form_builder
+ render :partial => ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {}, Proc.new {})
+ end
end
end
@@ -1230,6 +1234,13 @@ def test_partial_with_form_builder_subclass
assert_match(/<label/, @response.body)
assert_template('test/_labelling_form')
end
+
+ def test_nested_partial_with_form_builder
+ @controller = Fun::GamesController.new
+ get :nested_partial_with_form_builder
+ assert_match(/<label/, @response.body)
+ assert_template('fun/games/_form')
+ end
def test_partial_collection
get :partial_collection
@@ -0,0 +1 @@
+<%= form.label :title %>

0 comments on commit 96f5e59

Please sign in to comment.