SHow do you suppress ERB newlines globally


#1

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?


#2

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


#3

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


#4

Aha! Thanks!


#5

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


Kent

http://www.datanoise.com