diff options
author | huskins <huskins@linux-duhs.site> | 2011-07-13 13:06:03 -0400 |
---|---|---|
committer | huskins <huskins@linux-duhs.site> | 2011-07-13 13:06:03 -0400 |
commit | 2668dce1c004d19f1c94cbde9151cef0aa7ec120 (patch) | |
tree | c64ae0efc57872675561f54711d39bbdcf871be2 /actionpack/lib | |
parent | 704ee0df65b6ae9f39bbd4c7b3ed697a4039efd8 (diff) | |
download | rails-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')
-rw-r--r-- | actionpack/lib/action_view/renderer/partial_renderer.rb | 6 |
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 |