diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-17 12:28:03 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-17 12:28:03 -0700 |
commit | 7669c33c745b3e35e5c080bdeea3a991de3e8183 (patch) | |
tree | 188ec7e237352821cf8d16c98558afe207ae8c53 /actionpack/lib | |
parent | ac97e25235e57a3f9da76d37eaa48c269ad9cf86 (diff) | |
parent | 2668dce1c004d19f1c94cbde9151cef0aa7ec120 (diff) | |
download | rails-7669c33c745b3e35e5c080bdeea3a991de3e8183.tar.gz rails-7669c33c745b3e35e5c080bdeea3a991de3e8183.tar.bz2 rails-7669c33c745b3e35e5c080bdeea3a991de3e8183.zip |
Merge pull request #2018 from bhus/render_partial_invalid_check
Render partial invalid check
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 |