aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-12-14 18:07:20 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-12-14 18:07:20 +0000
commit78727dd8e226f16fd2446db0bcaf41e127ba9bc8 (patch)
tree9aa8943dbe7fddcbdbc38c78362737bae910df58
parent7a224356a88f104b6bf012e930721efb2274c2b1 (diff)
downloadrails-78727dd8e226f16fd2446db0bcaf41e127ba9bc8.tar.gz
rails-78727dd8e226f16fd2446db0bcaf41e127ba9bc8.tar.bz2
rails-78727dd8e226f16fd2446db0bcaf41e127ba9bc8.zip
Fixed that ActionView#file_exists? would be incorrect if @first_render is set (closes #10569) [dbussink]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/base.rb2
-rw-r--r--actionpack/test/action_view_test.rb18
3 files changed, 21 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 2a5bbee72f..0388f09b66 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]
+
* Added that Array#to_param calls to_param on all it's elements #10473 [brandon]
* Ensure asset cache directories are automatically created. #10337 [Josh Peek, Chu Yeow]
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index ee10d8cb0a..5b34b855e1 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -404,7 +404,7 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
if template_file_extension
template_exists?(template_file_name, template_file_extension)
else
- pick_template_extension(template_path)
+ template_exists?(template_file_name, pick_template_extension(template_path))
end
end
diff --git a/actionpack/test/action_view_test.rb b/actionpack/test/action_view_test.rb
index 729438af32..a69ff36f9f 100644
--- a/actionpack/test/action_view_test.rb
+++ b/actionpack/test/action_view_test.rb
@@ -23,4 +23,22 @@ class ActionViewTests < Test::Unit::TestCase
assert_equal expectation, base.send(:find_template_extension_from_first_render)
end
end
+
+ def test_should_report_file_exists_correctly
+ base = ActionView::Base.new
+
+ assert_nil base.send(:find_template_extension_from_first_render)
+
+ assert_equal false, base.send(:file_exists?, 'test.rhtml')
+ assert_equal false, base.send(:file_exists?, 'test.rb')
+
+ base.instance_variable_set('@first_render', 'foo.rb')
+
+ assert_equal 'rb', base.send(:find_template_extension_from_first_render)
+
+ assert_equal false, base.send(:file_exists?, 'baz')
+ assert_equal false, base.send(:file_exists?, 'baz.rb')
+
+ end
+
end