aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG32
-rw-r--r--actionpack/lib/action_view/base.rb2
2 files changed, 33 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index b8a491f4d8..05569a2c06 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,37 @@
*SVN*
+* Added option to ERB templates to swallow newlines by using <% if something -%> instead of just <% if something %>. Example:
+
+ class SomeController < AbstractApplicationController
+ <% if options[:scaffold] %>
+ scaffold :<%= singular_name %>
+ <% end %>
+ helper :post
+
+ ...produces this on post as singular_name:
+
+ class SomeController < AbstractApplicationController
+
+ scaffold :post
+
+ helper :post
+
+ ...where as:
+
+ class SomeController < AbstractApplicationController
+ <% if options[:scaffold] -%>
+ scaffold :<%= singular_name %>
+ <% end -%>
+ helper :post
+
+ ...produces:
+
+ class SomeController < AbstractApplicationController
+ scaffold :post
+ helper :post
+
+ [This undocumented gem for ERb was uncovered by bitsweat]
+
* Fixed CgiRequest so that it'll now accept session options with Symbols as keys (as the documentation points out) [Suggested by Andreas]
* Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 683cb8af6f..24c33cd11d 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -251,7 +251,7 @@ module ActionView #:nodoc:
end
def rhtml_render(template, binding)
- @@compiled_erb_templates[template] ||= ERB.new(template)
+ @@compiled_erb_templates[template] ||= ERB.new(template, nil, '-')
@@compiled_erb_templates[template].result(binding)
end