Using here documents in views

I’m trying to use a here document to define a multiple-line string in a
.rhtml file.
I keep getting compile errors- “the specified string (by identifier)
could not be found before EOF”

I’m trying:

<% my_str = <<MY_END
text
MY_END %>

I’ve also tried in seperate ERb blocks

<% my_str = <<MY_END %>
text
<% MY_END %>

Same problem. Is there a simple thing I need to do?

Thanks a lot.

Hi –

On Fri, 22 Sep 2006, mankeyrabbit wrote:

MY_END %>

I’ve also tried in seperate ERb blocks

<% my_str = <<MY_END %>
text
<% MY_END %>

Same problem. Is there a simple thing I need to do?

Try this:

<% my_str = <<MY_END
text
MY_END
%>

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org

sorted! thank you!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs