SHow do you suppress ERB newlines globally

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?

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 = ‘>’

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 -%>

Aha! Thanks!

Now you have to delete all those ‘-’ characters throughout all your
pages :slight_smile:


Kent