aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-07-07 11:57:53 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-07-09 10:42:29 -0700
commit4354aa36fb0b94f3750256441054d42db9900bf5 (patch)
tree5005e70a1c2d2dd138c13bfd960f06baa2fe0894 /actionpack
parent350faf14e80740a440ab16c7130c5262d603d283 (diff)
downloadrails-4354aa36fb0b94f3750256441054d42db9900bf5.tar.gz
rails-4354aa36fb0b94f3750256441054d42db9900bf5.tar.bz2
rails-4354aa36fb0b94f3750256441054d42db9900bf5.zip
Rendering default template for missing actions works with non-word characters in action name
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/template_file.rb2
-rw-r--r--actionpack/test/controller/new_render_test.rb5
-rw-r--r--actionpack/test/fixtures/test/hyphen-ated.erb1
3 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/template_file.rb b/actionpack/lib/action_view/template_file.rb
index c38e8ed122..0aa16b5e70 100644
--- a/actionpack/lib/action_view/template_file.rb
+++ b/actionpack/lib/action_view/template_file.rb
@@ -74,7 +74,7 @@ module ActionView #:nodoc:
# Returns file split into an array
# [base_path, name, format, extension]
def split(file)
- if m = file.match(/^(.*\/)?(\w+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
+ if m = file.match(/^(.*\/)?([^\.]+)\.?(\w+)?\.?(\w+)?\.?(\w+)?$/)
if m[5] # Mulipart formats
[m[1], m[2], "#{m[3]}.#{m[4]}", m[5]]
elsif m[4] # Single format
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index b2691d981b..b4dc2bb4dc 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -489,6 +489,11 @@ class NewRenderTest < Test::Unit::TestCase
assert_equal "<html>Hello world!</html>", @response.body
end
+ def test_renders_default_template_for_missing_action
+ get :'hyphen-ated'
+ assert_template 'test/hyphen-ated'
+ end
+
def test_do_with_render
get :render_hello_world
assert_template "test/hello_world"
diff --git a/actionpack/test/fixtures/test/hyphen-ated.erb b/actionpack/test/fixtures/test/hyphen-ated.erb
new file mode 100644
index 0000000000..cd0875583a
--- /dev/null
+++ b/actionpack/test/fixtures/test/hyphen-ated.erb
@@ -0,0 +1 @@
+Hello world!