Forum: Ruby on Rails SHow do you suppress ERB newlines globally

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lindsay B. (Guest)
on 2006-02-20 16:46
Is there a config flag to suppress the newline at the end of every ERB
'%>' tag, so it would not be necessary to type '-%> each time?
Joshua S. (Guest)
on 2006-02-20 17:15
(Received via mailing list)
On Monday, February 20, 2006, at 3:46 PM, Lindsay B. wrote:
>Is there a config flag to suppress the newline at the end of every ERB
>'%>' tag, so it would not be necessary to type '-%> each time?
>

You would include this line in your environment.rb file:

ActionView::Base.erb_trim_mode = '>'
Lindsay B. (Guest)
on 2006-02-20 17:26
> You would include this line in your environment.rb file:
>
> ActionView::Base.erb_trim_mode = '>'

I've added this line and restarted the server. I get the following
error:

---
Rendering  within layouts/users
Rendering users/profile
ERROR: compiling _run_html_users_profile RAISED compile error
public/../config/../app/views/users/profile.rhtml:31: parse error,
unexpected tSTRING_BEG, expecting kDO_COND or ':' or '\n' or ';'
---

Line 31 is the first line of ERB ending in a '%>' tag to be rendered by
the controller:

30:		<% for @box in @boxes -%>
31: 			<%= render :partial => 'boxes/box_line' %>
32:		<% end -%>
Kent S. (Guest)
on 2006-02-20 18:10
(Received via mailing list)
Now you have to delete all those '-' characters throughout all your
pages :)

--
Kent
---
http://www.datanoise.com
Lindsay B. (Guest)
on 2006-02-20 19:26
Aha! Thanks!
This topic is locked and can not be replied to.