This project is archived and is in readonly mode.
Changeset [9de83050d3a4b260d4aeb5d09ec4eb64f913ba64] by Carlhuda
Revision 9de83050d3a4b260d4aeb5d09ec4eb64f913ba64,
committed by Carlhuda
· March 15th, 2010 @ 09:50 PM
Add deprecation notices for <% %>.
- The approach is to compile <% %> into a method call that checks whether the value returned from a block is a String. If it is, it concats to the buffer and prints a deprecation warning.
- <%= %> uses exactly the same logic to compile the template, which first checks to see whether it's compiling a block.
- This should have no impact on other uses of block in templates. For instance, in <% [1,2,3].each do |i| %><%= i %><% end %>, the call to each returns an Array, not a String, so the result is not concatenated
- In two cases (#capture and #cache), a String can be returned that should never be concatenated. We have temporarily created a String subclass called NonConcattingString which behaves (and is serialized) identically to String, but is not concatenated by the code that handles deprecated <% %> block helpers. Once we remove support for <% %> block helpers, we can remove NonConcattingString. http://github.com/rails/rails/commit/9de83050d3a4b260d4aeb5d09ec4eb...
15 changed files
-
A
actionpack/test/fixtures/test/deprecated_nested_layout.erb -
R
actionpack/lib/action_view/helpers/deprecated_block_helpers.rb -
M
actionpack/lib/action_controller/caching/fragments.rb -
M
actionpack/lib/action_view/base.rb -
M
actionpack/lib/action_view/helpers/cache_helper.rb -
M
actionpack/lib/action_view/helpers/capture_helper.rb -
M
actionpack/lib/action_view/helpers/prototype_helper.rb -
M
actionpack/lib/action_view/render/rendering.rb -
M
actionpack/lib/action_view/template/handlers/erb.rb -
M
actionpack/test/controller/caching_test.rb -
M
actionpack/test/fixtures/layouts/block_with_layout.erb -
M
actionpack/test/fixtures/test/nested_layout.erb -
M
actionpack/test/fixtures/test/using_layout_around_block.html.erb -
M
actionpack/test/template/erb/tag_helper_test.rb -
M
actionpack/test/template/render_test.rb