aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/renderer
diff options
context:
space:
mode:
authorhuskins <huskins@linux-duhs.site>2011-07-13 13:06:03 -0400
committerhuskins <huskins@linux-duhs.site>2011-07-13 13:06:03 -0400
commit2668dce1c004d19f1c94cbde9151cef0aa7ec120 (patch)
treec64ae0efc57872675561f54711d39bbdcf871be2 /actionpack/lib/action_view/renderer
parent704ee0df65b6ae9f39bbd4c7b3ed697a4039efd8 (diff)
downloadrails-2668dce1c004d19f1c94cbde9151cef0aa7ec120.tar.gz
rails-2668dce1c004d19f1c94cbde9151cef0aa7ec120.tar.bz2
rails-2668dce1c004d19f1c94cbde9151cef0aa7ec120.zip
Added view template invalid name check, along with tests. No merges in commit.
Diffstat (limited to 'actionpack/lib/action_view/renderer')
-rw-r--r--actionpack/lib/action_view/renderer/partial_renderer.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb
index a351fbc04f..e31712eb73 100644
--- a/actionpack/lib/action_view/renderer/partial_renderer.rb
+++ b/actionpack/lib/action_view/renderer/partial_renderer.rb
@@ -301,6 +301,12 @@ module ActionView
paths.map! { |path| retrieve_variable(path).unshift(path) }
end
+ if String === partial && @variable !~ /^[a-z_][a-zA-Z_0-9]*$/
+ raise ArgumentError.new("The partial name (#{partial}) is not a valid Ruby identifier; " +
+ "make sure your partial name starts with a letter or underscore, " +
+ "and is followed by any combinations of letters, numbers, or underscores.")
+ end
+
self
end